问题描述
setSelection不会在reloadGrid之后选择ID为2的行.
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″);
但是,当您删除此行时,setSelection可以选择ID为2的行:$(#training").trigger("reloadGrid");
However, setSelection can select the row, whose id is 2, when you take this line out: $("#training").trigger("reloadGrid");
有人遇到同样的问题吗?
Anybody experiences the same issue?
谢谢
推荐答案
您应该在填充jqGrid之后选择行.因此,您应该放置
You should select row after the jqGrid will be filled. So you should place
$("#training").jqGrid('setSelection', "2");
在loadComplete
事件处理程序内部的
,并且不会在$("#training").trigger("reloadGrid");
之后立即调用它,因为trigger
调用jQuery.ajax
是异步工作的.
inside of loadComplete
event handler and not call this immediately after $("#training").trigger("reloadGrid");
because trigger
call jQuery.ajax
which work asynchronously.
这篇关于jqGrid的setSelect在reloadGrid之后不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!