是否可以在ag-grid
angularjs中设置columnDefs Index值?
基于用户加载时间我需要更改col的顺序.
对于某些用户,我需要按此顺序显示网格数据.
在Grid Col1:Model,Col2:Rate,Col3:Price
对于某些用户,我需要按此顺序显示网格数据.
在Grid Col1中:价格,Col2:Rate,Col3:Model
最佳答案 在ag-grid.js中替换此函数
ColumnController.prototype.extractRowGroupColumns = function () {
var _this = this;
this.rowGroupColumns = [];
// pull out the columns
this.allColumns.sort(function(a, b){
return a.colDef.seqNo-b.colDef.seqNo
})
this.allColumns.forEach(function (column) {
if (typeof column.getColDef().rowGroupIndex === 'number') {
_this.rowGroupColumns.push(column);
}
});
// then sort them
this.rowGroupColumns.sort(function (colA, colB) {
return colA.getColDef().rowGroupIndex - colB.getColDef().rowGroupIndex;
});
};
在标题数据中添加一个名为seqNo的列
$scope.gridheaders = [
{headerName: "ID", field: "ID", seqNo:0},
{headerName: "Patient Name", field: "PatientName", seqNo:1},
{headerName: "Gender", field: "Gender", seqNo:3},
{headerName: "Age", field: "Age", seqNo:2},
{headerName: "Phone Number", field: "mobileNumber", seqNo:4}
];
然后根据用户动态设置seqno …