您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

在jqGrid中,是否仍然可以使用Ajax获取custom_element的数据?

在jqGrid中,是否仍然可以使用Ajax获取custom_element的数据?

您可以在网格初始化期间使用任何list选项(准确地说是editoptions),然后用从服务器加载的实际数据覆盖该值:

$("#list").jqGrid({
    colModel: [
        {name:'MyMultiCheck',edittype:'custom',
         editoptions:{custom_element:MultiCheckElem,
                      custom_value:MultiCheckVal,list:''}
        }
        ...
    ]
    ...
});
$.ajax({
    url:"getMultiCheckList",
    // any other parameters like dataType:'json',
    // type: 'POST' (default type is 'GET') which depend on the server
    success: function(data){
        // the code here depend on the format of data returned from the server
        // in the simplest situation we have as data already the comma-separated
        // string which we need as a value for the list parameter so we can do
        jQuery("#list").setColProp('MyMultiCheck',{editoptions:{list:data}});
    }
});
其他 2022/1/1 18:14:06 有620人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶