开发者

Catching a select change event from within a JqGrid

开发者 https://www.devze.com 2023-02-20 19:58 出处:网络
I am working on an MVC project, which uses JQGrid. In开发者_运维技巧 one of my grids, I have a subgrid. Within the subgrid one of the columns is a dropdownlist. I would like to catch the change event

I am working on an MVC project, which uses JQGrid. In开发者_运维技巧 one of my grids, I have a subgrid. Within the subgrid one of the columns is a dropdownlist. I would like to catch the change event of this dropdownlist, so that I can set a default value of the next cell along using the selected item.

I used Firebug to see the Id of the <select> html, and tried the following code, which doesn't fire the alert:

$('#MySelectId').change(function() {
        alert('Test');
    });

This approach worked when using the modal edit form, but I am using inline editing, and would like to catch the event when the user changes the dropdownlist on the grid.


You can define dataEvents property as the part of editoptions. In the dataEvents you defines your custom 'change' event handle and jqGrid will make the binding after the corresponding cell will be initialized in the editing mode. See here or here examples.

0

精彩评论

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

关注公众号