我在jqgrid中为单选按钮使用自定义编辑类型。选择行并单击编辑后,所有内容都是第一次正常工作。但是从第二次开始它甚至没有调用custom_element中提到的函数。
我的jqgrid列规范如下。
{name: "StatusName", editable: true, edittype: "custom", editoptions: {custom_element: radioelement, custom_value: radiovalue}}
custom_element函数是:
function radioelement(value, options) {
var receivedradio = '<input type="radio" name="status" value="Active"',
breakline = '/>Active<br>',
naradio = '<input type="radio" name="status" value="InActive"',
endnaradio = '/>Inactive<br>';
if (value === 'Active') {
return "<span>" + receivedradio + ' checked="checked"' + breakline + naradio + endnaradio + "</span>";
}
if (value === 'InActive') {
return "<span>" + receivedradio + breakline + naradio + ' checked="checked"' + endnaradio + "</span>";
}
return "<span>" + receivedradio + breakline + naradio + endnaradio + "</span>";
};
custom_value函数是:
function radiovalue(elem, operation, value) {
if (operation === 'get') {
return $(elem).val();
} else if (operation === 'set') {
if ($(elem).is(':checked') === false) {
$(elem).filter('[value=' + value + ']').attr('checked', true);
}
}
};
请帮我解决这个问题