更改 Arcgis Javascript 功能 Table 的默认排序顺序
Change default Sort order for Arcgis Javascript Feature Table
我希望在功能 Table 首次出现时将其显示在第一列,而不是要求用户通过单击列 header 对其进行排序。我一直无法找到一种方法来做到这一点。
不确定这是否是最佳解决方案,如果能够在构造函数中设置它会很好,但是如果您在网格触发加载事件后调用 myFeatureTable.grid.set('sort', [{ attribute: ''}]);
,这将在之前对其进行排序它出现在 UI 中。例如:
on(myFeatureTable, "load", function(){
myFeatureTable.grid.set('sort', [{ attribute: "<attribute used in first column>"}]);
});
另一种方法如果你没有要求dojo/on
,你可以使用功能table的on方法。
myFeatureTable.on('load', function () {
// Sort on the Name attribute
myFeatureTable.grid.set('sort', [{ attribute: "Name" }]);
})
我希望在功能 Table 首次出现时将其显示在第一列,而不是要求用户通过单击列 header 对其进行排序。我一直无法找到一种方法来做到这一点。
不确定这是否是最佳解决方案,如果能够在构造函数中设置它会很好,但是如果您在网格触发加载事件后调用 myFeatureTable.grid.set('sort', [{ attribute: ''}]);
,这将在之前对其进行排序它出现在 UI 中。例如:
on(myFeatureTable, "load", function(){
myFeatureTable.grid.set('sort', [{ attribute: "<attribute used in first column>"}]);
});
另一种方法如果你没有要求dojo/on
,你可以使用功能table的on方法。
myFeatureTable.on('load', function () {
// Sort on the Name attribute
myFeatureTable.grid.set('sort', [{ attribute: "Name" }]);
})