Forum


Hi,
I have a grid it has rows with subgrids which of them has some rows with images with onclick event.
Every time an image is clicked then a server-side acction is performed, but then I need to reload the subgrid so I need to update the values.
I have tryed : $("#grid2_1").trigger("reloadGrid");
but is doesn't work, I have looked for in the documentation, but I haven't found anyhing.
Any Idea?
thanks in advance.
Josep Escofet
06:24

Moderators
30/10/2007

Hello,
Could you please post the code or make a link to the problem?
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.
Yes, The grid is reloading ok, but I want the first subgrid when the grid is reloaded will appear as expanded. I have tried this : $("#grid2").expandSubGridRow("1"); but dosent work.
jQuery("#grid2").jqGrid({
url:'${urlLlista0}',
datatype: 'json',
height: 250,
colNames:['Notes'],
colModel:[ {name:'note',index:'note', width:800, sortable:false}
],
imgpath: '${jgridImgPath}',
multiselect: false,
subGrid : true,
caption: "Manipulating Array Data",
toolbar: [true,"bottom"],
loadError: function (xhr,st,err){
alert(xhr.responseText()+" "+st+" "+err);
},
gridComplete: function() {
alert("cmplete");
$("#grid2").expandSubGridRow("1");
},
subGridRowExpanded: function(subgrid_id, row_id) {
//alert(subgrid_id+"<>__<>"+row_id);
// we pass two parameters
// subgrid_id is a id of the div tag created whitin a table data
// the id of this elemenet is a combination of the "sg_" + id of the row
// the row_id is the id of the row
// If we wan to pass additinal parameters to the url we can use
// a method getRowData(row_id) - which returns associative array in type name-value
// here we can easy construct the flowing
var subgrid_table_id, pager_id;
subgrid_table_id = subgrid_id+"_t";
pager_id = "p_"+subgrid_table_id;
$("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");
jQuery("#"+subgrid_table_id).jqGrid({
url:"${urlLlista2}",
datatype: "json",
colNames:['${observacion}','${usuarioObs}','${fechaObs}','${borrar}'],
colModel :[
{name:'observacion',index:'observacion', align:'left', width:420, editable:false, sortable:false},
{name:'usuarioObs',index:'usuarioObs', align:'left', width:150, editable:false, sortable:false},
{name:'fechaObs',index:'fechaObs', align:'left', width:75, editable:false, sortable:false},
{name:'acciones',index:'acciones', align:'center', width:75, editable:false, sortable:false}
],
rowNum:10,
imgpath: '${jgridImgPath}',
sortname: 'num',
sortorder: "asc",
loadComplete: function(){
var esBorrable = jQuery("#"+subgrid_table_id).getUserData();
if ('N' == '${tareacom.swRealizado}'){
var ids = jQuery("#"+subgrid_table_id).getDataIDs();
for(var i=0;i<ids.length;i++){
if (esBorrable[i] == 'S') {
be = "<img src='${delImg}' id='"+i+"img' width='16' height='16' border='0' title='Borrar Observación' onclick='delObservacion("+i+")'/>";
jQuery("#"+subgrid_table_id).setRowData(ids[i],{acciones:be});
}
}
}
},
height: '100%' });
},
subGridRowColapsed: function(subgrid_id, row_id) {
// this function is called before removing the data
//var subgrid_table_id;
//subgrid_table_id = subgrid_id+"_t";
//jQuery("#"+subgrid_table_id).remove();
}
});
$("#t_grid2").html(${addObservacion});
});
08:15

Moderators
30/10/2007

Hello,
I'm not 100% sure, but 3.1 version does not have this method. Upgrade to the latest stable. Or at least open grid.subgrid.js and see if this method is available.
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:
80 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