JqGrid - Merging the Grid Column Model javascript & JSON response

前端 未结 1 1446
心在旅途
心在旅途 2021-01-25 11:52

Is it possible to merge the Column Model javascript file and the raw data JSON response into 1 file?

Oleg - here you go:

JSON - codes.js

1条回答
  •  死守一世寂寞
    2021-01-25 12:14

    You should modify the code of buildSelect to about the following

    buildSelect: function (data) {
        var s = '";
    }
    

    Additionally you should use ajaxSelectOptions to set any options of the corresponding $.ajax request which you jqGrid if it get data from from the server. In any way you should use relative URLs like json/codes.json or /json/codes.json instead of http://localhost/json/codes.json.

    An example of ajaxSelectOptions parameter could be the following

    ajaxSelectOptions: {
        dataType: 'json',
        cache: false
    }
    

    If contentType: "application/x-javascript; charset=utf-8" is really required you can add it as additional property of ajaxSelectOptions.

    How you can see from the demo the selects will be produced correct from your JSON data by above buildSelect function. The select looks like

    
    

    0 讨论(0)
提交回复
热议问题