Forum


Not all of the main grid rows will have a sub row. This is indicated by one of the fields returned with the row. In the documentation I see code to disable/enable a sub grid: $("grid_id").hideCol("subgrid").
Can this be used with the postdate function to archieve the desired effect of not displaying (+ or -) when there isn't any sub row to display?
Do you have any examples of code to perform this?
TIA, Jim
01:26

Moderators
30/10/2007

Hello,
Humm - very interesting. Also as main directions - you can remove the image from the subgrid column and unbind the click (in this case the toggle) something like this: I suppose the subgrid column is the first and you have the rowid
$("#"+rowid+" td:eq(0)").empty().unbind("toggle")
Please let me known if this work.
Regards
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.
09:02

Moderators
30/10/2007

Sorry,
Try this:
$(”#”+rowid+” td:eq(0)”).empty().unbind(”click”)
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.
Anyone,
I've been search your documentation and the web all day. I can't find the syntax to use for the afterInsertRow event. This is what I've got:
colModel :[
{name:'x_object_id',index:'x_object_id', align:"center", sorttype:"string", width:80},
{name:'x_priority',index:'x_priority', align:"center", sorttype:"string", width:80},
{name:'x_site_id',index:'x_site_id', align:"center",sorttype:"string", width:90},
{name:'x_site_name',index:'x_site_name', align:"center",sorttype:"string", width:150},
{name:'x_status',index:'x_status', align:"center", sorttype:"string", width:100},
{name:'x_title',index:'x_title', align:"left", sorttype:"string", width:300},
{name:'x_creation_dt',index:'x_creation_dt', align:"center", sorttype:"string", width:200},
{name:'objid',index:'objid', hidden:true},
{name:'x_object_objid',index:'x_object_objid', hidden:true},
{name:'x_parent_type',index:'x_parent_type', hidden:true}
],
afterInsertRow: function(rowid,rowdata,rowelem){
if (rowid && rowdata:x_parent_type:value !== "children"){
$(”#”+rowid+” td:eq(0)”).empty().unbind(”click”)); 1
}
},
This of course doesn't work but I can't find an example any where.
The condition I'm testing for is:
if the x_parent_type does not have a value of children
Remove the the + toggle from the row.
thanks again, Jim
03:05

Moderators
30/10/2007

Hello,
Could you please try only this to be a sure that all subgrids are empty:
afterInsertRow: function(rowid,rowdata,rowelem){
$(”#”+rowid+” td:eq(0)”).empty().unbind(”click”));
}
This will ensure that the code is working.
Also I'm not sure what you try to do with this
if (rowid && rowdata:x_parent_type:value !== “children”)
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.
Tony,
In Firebug on FF I get this error on the code you ask me to run.
From running this code:
afterInsertRow: function(rowid,rowdata,rowelem){
$(”#”+rowid+” td:eq(0)”).empty().unbind(”click”));
},
The answer to your second question of what I was trying to do with this statement:
if (rowid && rowdata:x_parent_type:value !== “children”)
In my top grid query, NOT all rows will have a sub rows. The x_parent_type column will have a value of "children" if there are sub rows. If the the value of the x_parent_type is NOT Equal to "children" I need to disable the subgrid toggle.
Thanks, Jim
Jim P said: The error statement got moved to the bottom of my last post.
Tony,
In Firebug on FF I get this error on the code you ask me to run.
illegal character$(”#”+rowid+” td:eq(0)”).empty().unbind(”click”));},\\nFrom running this code:
afterInsertRow: function(rowid,rowdata,rowelem){
$(”#”+rowid+” td:eq(0)”).empty().unbind(”click”));
},
08:24

Moderators
30/10/2007

Hello,
You should not copy paste the code from here, but understand what I try to expalin.
Here is a working example tested on my demo:
$("#mygrid").jqGrid({
...,
afterInsertRow : function(rowid,rowdata,rowelem) {
$("#"+rowid+" td:eq(0)").empty().unbind("click");
},
...
});
Hope this helps
Regards
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.
Thanks Tony,
That worked! The problem was the wrong ” - correct ".
The if statement still isn't working.
afterInsertRow : function(rowid,rowdata,rowelem) {
if (rowdata:x_parent_objid:value > 0 && rowdata:x_parent_type:value !== "children")
$("#"+rowid+" td:eq(0)").empty().unbind("click");
},
No errors in FB, just doesn't return anything. Blank screen.
Thanks again, Jim
09:11

Moderators
30/10/2007

Hello,
Maybe it is a good idea to learn how to get values from JS object. Sorry if this make you something wrong, but expression of type:
rowdata:x_parent_objid does not exists at all in JS - you should do something like this:
note the . and not :
if ( parseInt(rowdata.x_parent_objid) > 0 && rowdata.x_parent_type !== 'children') {
// do something here
}
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.
For those that have been following this thread:
To toggle the subgrid indicator on/off based on field(s) in your main query.
$("#mygrid").jqGrid({
...,
afterInsertRow : function(rowid,rowdata,rowelem) {
if (rowdata.x_parent_type == "children" && rowdata.x_parent_objid == 0)
{
$("#"+rowid+" td:eq(0)").empty().unbind("click");
}
},
...
});
In my instance my query returned two fields (hidden) that controled the toggle.
Have fun and Tony thanks again, Jim
Most Users Ever Online: 715
Currently Online:
43 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