0

これを共通関数としてグリッドの初期化の下でグローバル化しました。すべての列のデフォルトとして並べ替えを使用しました。IgGrid がロードされた後、特定の列に「allowSorting」を設定する必要があります。ここにサンプルコードを追加しました。この変数「colSettings」に「allowSorting」を設定できません。

      $("#gridSorting").igGrid({
            primaryKey: "ProductID",
            columns: [
            { headerText: "Product ID", key: "ProductID", dataType: "number" },
            { headerText: "Product Name", key: "Name", dataType: "string", template: '<a id="name${ProductID}">${Name}</a>' },
            { headerText: "Product Number", key: "ProductNumber", dataType: "string", template: '<input type="text" class="txtBox" id="${ProductID}" value="" />' },
            { headerText: "Product Key", key: "ProductKey", dataType: "string", template: '<input type="text" class="txtBox1" maxlength="4" id="${ProductKey}" value="${ProductKey}" />' }
        ],
            features: [
            {
                name: "RowSelectors",
                enableCheckBoxes: true,
                enableRowNumbering: false
            },
            {
                name: "Selection",
                mode: 'row',
                multipleSelection: true

            },
            {
                name: "Sorting",
                type: "local"
            }
        ],
            width: "500px",
            dataSource: products
        });

        var colSettings = [
                    {
                        columnKey: 'ProductID',
                        allowSorting: true
                    },
                    {
                        columnKey: 'Name',
                        allowSorting: true
                    },
                    {
                        columnKey: 'ProductNumber',
                        allowSorting: false
                    }
            ];

        $("#gridSorting").igGridSorting("option", "columnSettings", colSettings);

この例の特定の列に「allowSorting: false」を設定する方法を教えてください。

4

0 に答える 0