最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jqGrid's setSelect does not work after reloadGrid - Stack Overflow

programmeradmin0浏览0评论

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, setSelection can select the row, whose id is 2, when you take this line out: $("#training").trigger("reloadGrid");

Anybody experiences the same issue?

Thanks

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, setSelection can select the row, whose id is 2, when you take this line out: $("#training").trigger("reloadGrid");

Anybody experiences the same issue?

Thanks

Share Improve this question edited Mar 29, 2010 at 6:57 Matt Blaine 1,97614 silver badges22 bronze badges asked Mar 27, 2010 at 14:17 Viet PhamViet Pham 111 silver badge2 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

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)

  1. 暂无评论