Forum


22:45

04/04/2010

I am using the tableToGrid method with jqGrid. It works well up until i tried to plug it into one of our jsf grids which is loaded through ajax via an a4j control.
version is 3.6.5
The problem was on line 1967 of the grid.base.js. The t.rows[0] was undefined and because of this cells was throwing an exception. Only the first row was being inserted into our grid and then the code exited out.
I also noticed that if I saved the generated source and used the tableToGrid method that the grid functioned as it should. It looks like it's something with the way the a4j component dynamically loads the new table into the dom.
I was able to get around this by adding a check to t.rows[0]. (However now I don't have sorting or movable columns). I do have the grid however.
/*if(!t.grid.cols || !t.grid.cols.length) { t.grid.cols = t.rows[0].cells; }*/
if((!t.grid.cols || !t.grid.cols.length)&&t.rows[0]) { t.grid.cols = t.rows[0].cells;
I admit I didn't spend a lot of time trying to figure out if the cols parameter was needed for anything. Is there a better way to handle this and is this a bug?
Update:
I stepped through the code some more and found out that on the ajax/a4j loaded tables the t.rows.length property is not updated after the row is added to the grid on line 1943. I compared this to the tables which are not loaded through ajax and the t.rows.length property is being updated.
Also when looking at the element in firebug $("table:first",t.grid.bDiv), the rows parameter on the first element are empty where on the non-ajax table I can see the first row being inserted. On both grids the row does show under the getfirstElementchild parameter. Which doesn't seem right to me.
This looks like the actual source of the problem. There must be something different about the structures of both tables that's causing the inconsistencies.
Update 06/07/2010:
I also managed to narrow this problem down to only firefox. It works in Chrome, ie7 and ie8. It's very strange that the append(row) on line 1943 of the grid.base.js file is not working properly.
Most Users Ever Online: 715
Currently Online:
64 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66