开发者

jqGrid's setSelect does not work after reloadGrid

开发者 https://www.devze.com 2022-12-24 03:29 出处:网络
setSelection does not select the row, whose id is 2, right after a reloadGrid. $(\"#training\").setGridParam({url: \'index.php?func=trainingmgr&aAction=refreshData\'});

setSelection does not select the row, whose id is 2, right after a reloadGrid.

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

However, setSelectio开发者_C百科n can select the row, whose id is 2, when you take this line out: $("#training").trigger("reloadGrid");

Anybody experiences the same issue?

Thanks


You should select row after the jqGrid will be filled. So you should place

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

inside of loadComplete event handler and not call this immediately after $("#training").trigger("reloadGrid"); because trigger call jQuery.ajax which work asynchronously.


In several places in my application I am calling reloadGrid followed by setSelection, and the row is being selected successfully. Something else must be going on with your application. Did you try running this in Firebug to see if any errors are being thrown?

0

精彩评论

暂无评论...
验证码 换一张
取 消