sort:{direction:uiGridConstants.ASC} //正序
, sort: {direction: uiGridConstants.DESC //倒序
在指定列内加入sort进行排序
例如下面案例按照序号排序
$scope.gridOptions1 = {
enableGridMenu: false,
exporterMenuCsv: false,
enableCellEdit: false,
exporterOlderExcelCompatibility:true,//是否兼容低版本excel
exporterCsvFilename: '使用记录.csv',//excel导出名字
columnDefs: [
{
name: 'edit',
width: 250,
displayName: '操作',
fixed: true,
pinnedRight: false,
enableColumnMenu: false,
enableSorting: false,
cellTemplate: '<div class="ui-grid-cell-contents text-center publicBox">' +
'<button type="button" class="btn-xs btn blue btn-outline" data-ng-click="grid.appScope.checkDetail(row.entity)">' +
'<i class="fa fa-edit"></i><span style="padding-left: 2px;">查看</span></button> '
},
{field: 'ID', displayName: 'ID', visible: false, width: 50, fit: true},
{field: 'number', displayName: '序号', width: 50, fit: true,sort:{direction:uiGridConstants.ASC}},
{field: 'Applicant', displayName: '申请人', width: 100},
{field: 'TelephoneNumber', displayName: '申请人电话', width: 100},
]
};