开发者

Add an event handler to jqGrid after instantiation

开发者 https://www.devze.com 2023-01-05 18:01 出处:网络
I want to add an event handler to jqGrid (for the onSelectRow event) but after the grid has already been created on the page i.e. I cant hardcode it into the initial jqGrid definition.

I want to add an event handler to jqGrid (for the onSelectRow event) but after the grid has already been created on the page i.e. I cant hardcode it into the initial jqGrid definition.

I have tried using setGridParam to se开发者_Python百科t an event handler for onSelectRow but that didnt work :(

$('#list').jqGrid('setGridParam', { onSelectRow: function(id){ alert(id); } } );

The jqGrid docs are quite difficult to get what you want out of them and I havent found anything regarding this problem.


I just tested to use

$('#list').jqGrid('setGridParam', { onSelectRow: function(id){ alert(id); } } );

in my code and it works. If jqGrid has already an onSelectRow it overwrite the old one event handle. If there are no onSelectRow event handler, it add a new handler. So all must work.

If you do will have problem, you should post a code example which reproduce it.

0

精彩评论

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

关注公众号