Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Data contains a table -- g.p.colModel[a] is undefined
17/04/2012
22:49
Avatar
Shift4SMS
Las Vegas, NV
Member
Members
Forum Posts: 15
Member Since:
03/12/2010
sp_UserOfflineSmall Offline

I have a grid where one of the columns contain html code. Everything works fine until the html code within the column data contains a table, in which case I get a js exception: "g.p.colModel[a] is undefined". In the src, I narrowed it down to the following and created a work around that seems to work:

 …

getRowData : function( rowid ) {
  var res = {}, resall, getall=false, len, j=0;
  this.each(function(){
   var $t = this,nm,ind;
   if(typeof(rowid) == 'undefined') {
    getall = true;
    resall = [];
    len = $t.rows.length;
   } else {
    ind = $t.rows.namedItem(rowid);
    if(!ind) { return res; }
    len = 2;
   }
   while(j<len){
    if(getall) { ind = $t.rows[j]; }
    if( $(ind).hasClass('jqgrow') ) {
     $('td',ind).each( function(i) {
      try {
       nm = $t.p.colModel[i].name;
       if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn') {
        if($t.p.treeGrid===true && nm == $t.p.ExpandColumn) {
         res[nm] = $.jgrid.htmlDecode($("span:first",this).html());
        } else {
         try {
          res[nm] = $.unformat.call($t,this,{rowId:ind.id, colModel:$t.p.colModel[i]},i);
         } catch (e){
          res[nm] = $.jgrid.htmlDecode($(this).html());
         }
        }
       }
      } catch(e) {
      }
     });
     if(getall) { resall.push(res); res={}; }
    }
    j++;
   }
  });
  return resall ? resall: res;
 },…

The bold line is the code that is triggering the exception. The italic bold code is my work around that I added. My question is: Is my work around "safe" and/or is there a better way to accomplish this?

I tried creating a small stand-alone example but for some reason, my small example works. I think it may be related to the datatype of json — my small example cannot fully impliment this without creating a scripting dependancy — a hard coded html template for the getter is not cutting it. I can send what I have if it helps.

17/04/2012
23:06
Avatar
Shift4SMS
Las Vegas, NV
Member
Members
Forum Posts: 15
Member Since:
03/12/2010
sp_UserOfflineSmall Offline

BTW, I was originally receiving this error using version 4.2.0. I upgraded to version 4.3.2 with no effect.

18/04/2012
12:14
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

There is nothing bad with your fix, but before to implenent it it will bereally good to have a test case.

Thank you

Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

18/04/2012
18:15
Avatar
Shift4SMS
Las Vegas, NV
Member
Members
Forum Posts: 15
Member Since:
03/12/2010
sp_UserOfflineSmall Offline

Thanks. Someone replied to another thread for a slightly different symptom of the same problem. I did not realize they were related (in fact, I forgot I posted the other issue). anyway, the solution is in this thread: /blog/?page_id=393/bugs/l-p-colmodelx-is-undefined-with-html-data/

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
40 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information