jqGrid custom edittype (radio button column) custom element not firing set event on edit

故事扮演 提交于 2019-11-29 15:46:46
Oleg

I think that you are right. There are difference in usage of custom_value callback in different editing modes.

If form editing is used and some editable column has edittype: 'custom' then first custom_element function (in your case it's radioelem function) will be called inside of $.jgrid.createEl. Then custom_value will be called additionally in case of rowid !== "_empty" (not for Add form). See the lines of code for details.

The problem is that custom_element has value parameter. So it can set the value in the custom control and call custom_element and additional calling of custom_value with "set" is not really required.

Another editing modes (inline editing and cell editing) just create custom control. The callback custom_value will be never called with "set" parameter.

I confirm that the documentation about custom control is too short. I suppose that you can just remove the part of your code radiovalue for part 'set'. I think that the following code will good work too (even in case of form editing):

function radiovalue(elem, operation, value) {
    if (operation === 'get') {
        return $(elem).val();
    }
}

One remark: If you will try usage of custom controls you should don't forget to use recreateForm: true option. As an example of usage custom control in inline editing, form editing and searching you will find here. The reference to the demo you will find in the answer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!