Forum


Hi,
I have a grid with several rows that can have additional data which must be displayed as a subgrid.
The problem is:
If the row hasn't data I want the plus image dissapear.
If it is not possible, I want that if you click to plus image has not effect and there is no load url with empty content.
is it possible?
thanks in advance.
Josep Escofet
08:55

Moderators
30/10/2007

Hello,
There was a similar post but.
If you have record (field) in the master where you have information about the children in the subgrid you can use afterInsertRow to clear the plus for the subgrid something like (suppose you have field childrecords in colModel)
afterInsertRow: function(rowid, aMasterRow) {
if(parseInt(aMasterRow.childrecords,10) === 0) {
// remove the plus from subgrid
$("td.sgcollapsed","#"+rowid).empty().unbind('click');
}
}
If you do not want to remove the plus just use unbind.
Enjoy
Tony
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.
Hi Tony,
I have tried your solution and it works, but I have a minor problem:
On event : loadComplete: function(){
isSubgridData = jQuery("#gridGastos").getUserData();
}
I get an array of true, false elements, one for each row that indicate if there is more info to fetch when user click the image.
The problem is when I use this array into the afterInsertRow event, it says me that isSubridData is not defined.
afterInsertRow: function(rowid, aMasterRow) {
if (isSubgridData[rowid-1] == "false"){
$("td.sgcollapsed","#"+rowid).empty().unbind('click');
}
},
but if I put : isSubgridData = jQuery("#gridGastos").getUserData();
in the afterInsertRow then it works, but I don't think is 100% correct, becouse I am fetching the array on every row and It is not necesary.
Any idea?
Thanks in Advance.
Josep Escofet
Hi Tony,
I have tried your solution in more detail and I realised that in the first time it works correclty, but when the grid is reload with new data, then the first row isnt erase de plus image, but If I put the next it works for the first and next reloades.
rowid-1
$("td.sgcollapsed","#"+rowid-1).empty().unbind('click');
I don't know if it is correct, but it works.
thanks.
Josep Escofet.
PROBLEM SOLVED.
I have found the problem, in my page I have 2 grids. When you insert rows in the first grid they are saved in the serve.
But in the second grid I load the data from the server, but the data of grid is still loaded and there is a problem with the second grid and images id or something else.
If I clear the data of the first grid after saving on server, all works perfect.
Thanks.
Josep Escofet
Most Users Ever Online: 715
Currently Online:
96 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