How to reload/refresh subgrid in JQgrid? -
this of subgrid code in jquery. problem , have dropdown user. each user have own id , transmitted method. when select different user expected show in subgrid different values, not happens after manually refresh page (crtl + f5). im using ajax , json . code :
subgrid : true, subgridrowexpanded: function(subgrid_id, row_id) { //var projectidrow = $('#list2').jqgrid('getcell',rowid,'projectid'); //alert(row_id); var subgrid_table_id; subgrid_table_id = subgrid_id+"_t"; $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"'></table>"); $("#"+subgrid_table_id).jqgrid({ url:"/taskuri/subgrid/?id="+row_id+"&userid="+useralocat, datatype: "json", colnames: ['subtask',' ','pri','responsabil','alocator','alocat','deadline','estimat','lucrat',' '], colmodel: [ {name:"subtask",index:"subtask",width:'770%',align:"left",sortable:false}, {name:'finished',index:'finished', width:'42%',sortable:false}, {name:"pri",index:"pri",width:'60%', sortable:true}, {name:"responsabil",index:"responsabil",width:'144%',sortable:false}, {name:"alocator",index:"alocator",width:'140%',sortable:false}, {name:"alocat",index:"alocat",width:'122%',sortable:false}, {name:"deadline",index:"deadline",width:'122%',sortable:false}, {name:"estimat",index:"estimat",width:'84%',align:"right",sortable:false}, {name:"lucrat",index:"lucrat",width:'94%',align:"right"}, {name:"delete",index:"delete",width:'48%',align:"right"}, ], height: '100%', rownum:20 }); var useridlogat = $("#userid").val(); }, gridcomplete: function(){ //afiseaza subgridurile default var grid = $("#list2"); var svi_id = grid.jqgrid('getdataids'); $.each(svi_id, function (index, rowid) { $.post('/taskuri/checksubtask/', { rowid: rowid}, function(data){ if (data >= 1){ //data reprezinta numarul row urilor din query grid.jqgrid('expandsubgridrow',rowid); }else{ // else ul face , ca userul sa numai dea click pe poza +, asa se evita sa afiseze headurl ala fara date, adica cand nu contine date subgridul $('.sgcollapsed a').remove(); $(".ui-sgcollapsed:eq("+index+")" ).removeclass("sgcollapsed"); } }); }); },
what can do? thx
//if textbox $("#textinputid").keyup(function() { reloadjqgrid(); }); //if dropdown $("#dropdownid").on("change",function() { reloadjqgrid(); });
Comments
Post a Comment