1

これは、アプリケーション側から詳細を取得して、jsGrid によって構築されたグリッドの前面に表示するサンプル プロジェクトの jQuery コードです。

$("#part_table").jsGrid({
            height: "auto",
            width: "100%",
            autoload: true,
            editing: true,
            sorting: true,
            paging: true,
            pageSize: 10,
            inserting: true,
            loadIndication: false,
            filtering: true,
            headerRowClass: 'table-green-header',
            controller: {
                loadData: function (filter) {
                    function.....
                },
                updateItem: function (item) {

                    function.....

                }
            },
            fields: [
                { name: "Id", type: "number", visible: false },
                {
                    name: "CatalogueId", type: "select", **items**: catalouges, valueField: "Id", textField: "CatalougeName", selectedIndex : -1 , title: "Catalouge Name", align: "center"
                },

                { name: "DistributorPrice", type: "number", title: "Distributor Price", align: "center", filtering: false, sorting: false },
                { name: "IsActive", type: "checkbox", filtering: false, sorting: false },
                { type: "control" }


            ],
            rowClick: function (args) {
                return false;
            },
        });

AJAX呼び出しを介してアプリケーション側に呼び出して、項目のリストをフィールドに取得する方法を誰でも教えてもらえますか?

ありがとう

4

3 に答える 3

0

コントローラーの loadData に ajax 呼び出しを記述します。次のようなものです。

controller: {
                loadData: function(filter) {
                    return $.ajax({
                        type: "GET",
                        url: "/api/data",
                        data: filter,
                        dataType: "json"
                    });
}                    
}

さらに参照https://github.com/tabalinas/jsgrid-webapi

于 2016-08-15T07:47:03.200 に答える