Hi,
I'm having a problem refreshing my grid, because I add some extra buttons after I load my grid, but when I try to reload another button is added.
$j(document).ready(function (){
$j("#search").button().click(function() {
var loadingImg = "../img/bpm_scripts/common/images/images";
var ejecutive=$j("#ejecutiveId").val();
buildTable(ejecutive);
});
});
and
function buildTable( ejecutive){
$j("#list").jqGrid('setGridParam',
{postData:{ ejecutive:ejecutive}, search:true });
$j("#list2").trigger("reloadGrid");
$j("#list2").jqGrid({
url: "<f:invokeUrl methodName='getInstances' var='sales'/>",
datatype: "xml",
colNames:['Inv No','No','Creado','Actualizado','Estatus','Hotel'],
colModel:[
{name:'invoiceId',index:'invoiceId', width:40},
{name:'invoiceContracCustom',index:'invoiceContracCustom', width:50},
{name:'invoiceCreatedBy',index:'invoiceCreatedBy', width:100},
{name:'invoiceUpdatedBy',index:'invoiceUpdatedBy', width:100},
{name:'invoiceStatus',index:'invoiceStatus', width:75,align:'center'},
{name:'invoiceHotels',index:'invoiceHotels', width:75,align:'center'}
],
rowNum:10,
autowidth: true,
rowList:[10,20,30],
pager: jQuery('#pager2'),
sortname: 'invoiceId',
viewrecords: true,
sortorder: "desc",
xmlReader: {
root: "results",
row: "invoice",
repeatitems: false,
page: "page>currentpage",
total: "page>pages",
records:"page>records",
id: "invoiceId"
},
caption:"XML Example" }).navGrid('#pager2',
{edit:false,add:false,del:true},
{height:280,reloadAfterSubmit:false}, // edit options
{height:280,reloadAfterSubmit:false}, // add options
{reloadAfterSubmit:false}, // del options
{}); // search options
});
and then this is invoked:
$j("#list2").jqGrid('navButtonAdd','#pager2', {
caption:"",
buttonicon:"ui-icon-check",
position:"last",
onClickButton:function(){
var gsr = jQuery("#list2").jqGrid('getGridParam','selrow');
if(gsr){
$j.ajax({
url: "url",
type: 'GET',
async: true,
success: function() { alert('fine'); },
error:function() { alert('Se ha producido un error'); } });
}
else
alert("Please select Row") ;
}
});
} I don't know where should be this part, because if I put it before then no button is loaded.
Regards.