我已经在网格初始化下面将其全球化为一个通用函数。我已将排序用作所有列的默认值。在加载 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”。