[Jquery] JqG​​rid - 合并网格列模型的JavaScript和JSON响应


Answers

Question

是否有可能将Column Model JavaScript文件和原始数据JSON响应合并到一个文件中?

奥列格 - 你去了:

JSON - codes.json

{
    "codes":[
        {
            "code" : "WFH - Work From Home"
        },  
        {
            "code" : "OST - Onsite"
        }
]}

dataUrl和buildSelect - 这是绘制一个空的选择框

    editoptions: {
        dataUrl: 'http://localhost/json/codes.json',
        type: "GET",
        dataType: "json",
        contentType: "application/x-javascript; charset=utf-8",
        async: "true",
        buildSelect: function(response){
            var s = '<select>';
            $.each(response.codes, function(index, codes){
                s.append("<option>"+codes.code+"</option>");
            });
            return s + '</select>';
        }
    }},