jqGrid的setSelect在reloadGrid之后不起作用 [英] jqGrid's setSelect does not work after reloadGrid

查看:403
本文介绍了jqGrid的setSelect在reloadGrid之后不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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之后不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆