JqGrid setSelect not working after reload

setSelection does not select a row whose ID is 2 immediately after reloadGrid.

    $("#training").setGridParam({url: 'index.php?func=trainingmgr&aAction=refreshData'});
    $("#training").trigger("reloadGrid");
    $("#training").jqGrid('setSelection', "2″);

      

However, setSelection can select a string whose ID is 2 when you take that string: $ ("# training"). trigger ("reloadGrid");

Is anyone experiencing the same problem?

thanks

+1


a source to share


2 answers


You have to select the row after filling the jqGrid. Therefore, you must place

 $("#training").jqGrid('setSelection', "2");

      



inside the event handler loadComplete

and not call it immediately after $("#training").trigger("reloadGrid");

, because it trigger

calls jQuery.ajax

that works asynchronously.

+5


a source


In several places in my application I call reloadGrid

and then setSelection

and the row is fetched successfully. Something else must be happening with your application. Have you tried running this in Firebug to see if there are any errors?



0


a source







All Articles