2

如果使用 k-data-source,如何让 Kendo Grid 按特定字段排序?

这是我的 HTML:

这是我的控制器:

getBusinessUnits();
function getBusinessUnits() {
    operatorService.getBusinessUnits()
    .success(function (data) {

        $scope.businessUnits = data;
    });
};

$scope.gridOptions = {
    batch: false,
    reorderable: true,
    sortable: true,
    editable: "inline",



columns: [
  { template: '<i class="fa fa-chevron-circle-up" style="cursor:pointer" ng-click="MoveUp(#=OperatorBusinessUnitID#)"></i>&nbsp;&nbsp;&nbsp;<i class="fa fa-chevron-circle-down" style="cursor:pointer"></i>', title: "List Order" },
  { field: "OperatorBusinessUnitID", title: "Business Unit ID" },
  { field: "vchDescription", title: "Business Unit Name" },
  { field: "vchOperatorSystemID", title: "Operator System ID"},
  {
      command: [
        { name: "edit", text: " " },
        { name: "destroy", text: " " },
      ], title: "Action"
  }
]

};

服务从 SQL 数据库返回的数据是由 SQL 存储过程按照我需要的顺序返回的。但是,网格会自动默认为在 ID 列中对其进行排序。如果我没有在我的 Angular 控制器中“创建”数据源对象,有什么方法可以告诉它默认排序哪个字段?

4

0 回答 0