tvaLst = [{ id: 1, taux: 5, ole: true}, { id: 2, taux: 13.01, ole: false }];
Imagine that from a service I retrieve the above list of Objects, and I want to show the taux value and in the second column the Edit and Delete Option Only for the lines where the attribute ole is set to true.
this.gridSettings = {
bindingOptions: { dataSource: 'vm.tvaLst' },
allowColumnResizing: true,
scrolling: { mode: 'virtual' },
onContentReady: this.contentReadyAction,
paging: { enabled: false },
editing: {
mode: "row",
allowUpdating: true,
allowDeleting: true,
allowAdding: true
},
columns: this.gridColumns
};
In editing what should I do to allow this?
You can find and hide the Edit button in the onCellPrepared event handler.
Here is a sample code:
onCellPrepared: function (options, $container) {
if (options.column && options.column.command === "edit" && options.rowType == "data") {
if (options.cellElement.find('a').first().text() === 'Edit') {
if (options.data.ole === false){
options.cellElement.find('a').first().hide();
options.cellElement.find('a').eq(1).hide();
}
}
}
}
Here is on online example: http://plnkr.co/edit/l4PRpDkbaHRgB4ntXoQD?p=preview