|
actionBegin(args){
if(args.requestType == 'beginEdit' || args.requestType == 'add'){
this.grid.element.classList.add('g-added') // here we add the class to hide the add icon when the row in add or edit form
}
}
actionComplete(args){ if(args.requestType == 'cancel' || args.requestType =='save'){
this.grid.element.classList.remove('g-added') // here we remove the added class to show the icon when the save or cancel action completed
}
}
______________________________________________________________________________ [Index.css] .g-added .e-alter{
display: none;
} |
|
commandClick(args) { // commandClick Function if (this.grid && args.commandColumn.buttonOption.id == "alter") {
var newData = args.rowData; // here you can get the current row data by args.rowData
newData.ShipCountry = "Germany"; // here you can set the changed value to the row data
newData.CustomerName = "Yang Wang";
this.grid.setRowData(newData.OrderID,newData) // here you can update the new row data by using setRowData method of Grid
}
} |
Hello
In the demo: https://stackblitz.com/edit/react-x2qcjc-3u6bxb?file=index.js
Is it possible to hide or not to show "ALTER" button for Ship Country = "Germany" ? It make a user confusing because nothing happens.
Kind regards
Ela
Hi Elzbieta,
You can achieve your requirement by hiding the button inside the “rowDataBound” event based on the row data value. Please refer to the below code example, documentation, and sample link for more information.
|
rowDataBound(args) { if (args.data['ShipCountry'] == 'Germany') { args.row.querySelector('.e-alter').style.display = 'none'; } }
|
Documentation: https://ej2.syncfusion.com/react/documentation/grid/row/row/#row-customization
Sample : https://stackblitz.com/edit/react-x2qcjc-vyrmhj?file=index.js
Regards,
Pavithra S