Forum


07:48

24/12/2008

Hello everybody,
I want to have a loadComplete action in a subGrid.
So I made a grid in my grid as subgrid.
url:'Message.action',
datatype: “json”,
colNames:['<s:property value="documentIdColumnName"/> ', '<s:property value="statusColumnName"/> '<s:iterator id="col" value="columns">,'<s:property value="value"/>'</s:iterator>, 'errors', 'actions'],
colModel :[
{name:'id',index:'id', width:150, align:'center'},
{name:'status',index:'status', width:100, align:'center'},
<s:iterator id="col" value="columns">
{name:'<s:property value="value"/>',index:'<s:property value="value"/>', width:100, align:'center'},
</s:iterator>
{name:'errors', index:'errors',hidden:true},
{name:'actions', index:'actions', width:100, align:'left'}],
rowNum:10,
rowList:[10,20,30],
imgpath: 'themes/coffee/images',
pager: jQuery('#pagerInProgress'),
viewrecords: true,
sortorder: “desc”,
width: “780″,
height: “auto”,
caption:”<s:property value=”gridName”/>”,
loadComplete: createContentActions,
toolbar: [true,"bottom"],
subGrid: true,
subGridRowExpanded: function(subgrid_id, row_id) {
var subgrid_table_id;
subgrid_table_id = subgrid_id+”_t”;
jQuery(”#”+subgrid_id).html(”<table id='”+subgrid_table_id+”' class='scroll'></table>”);
jQuery(”#”+subgrid_table_id).jqGrid({
url:”Message/History.action?id=” + row_id,
datatype: “json”,
colNames: ['id', 'previous status','update', 'actions'],
colModel: [
{name:'id',index:'id', width:150, align:'center'},
{name:"previous status",index:"previous status",width:250},
{name:"update",index:"update",width:250,sortable:false},
{name:'actions', index:'actions', width:100, align:'left',sortable:false}
],
height: “auto”,
rowNum: 10,
imgpath: 'themes/coffee/images',
loadComplete: createStatusActions(subgrid_table_id)
});
}
});
So in my maingrid I have:
loadComplete: createContentActions
And that method looks like:
function createContentActions() {
var ids = $(”#datagrid”).getDataIDs();
do some cool stuff…
}
This works great but in my subgrid I have:
loadComplete: createStatusActions(subgrid_table_id)
And that method looks like
function createStatusActions(grid_table_id) {
var ids = jQuery(”#” + grid_table_id).getDataIDs();
do some cool stuff …
}
And this doesn't work. My ids in createStatusAction, wich is called for the subgrid is always empty. So this method is called before my grid is loaded. And I have also tried: gridComplete, with the same result.
Can someone help me. If hope the case is clear.
Thank you.
Compi
03:16

Moderators
30/10/2007

Hello,
The problem that you have is how you call the function in the subgrid.
You call it like this
loadComplete: createStatusActions(subgrid_table_id)
The right is:
loadComplete: createStatusActions
Or simple if you want to thest make this:
loadComplete:function() {
// here the code from createStatusActions
}
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.
Most Users Ever Online: 715
Currently Online:
32 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