Hi,
I have a Data Grid with a Command column.
I would like to change one of my button's iconCss based on the value of a field in my dataSource.
Is this possible? If yes, please provide an example, thanks.
|
// Grid’s rowDataBound event handler
onRowDataBound: function(args) {
// Retrieves the command buttons element from the current row
var commandEle = args.row.querySelector('.e-unboundcell');
// Retrieves the required command button(based on its title content) from the command buttons element
var commandButtonEle = commandEle.querySelector('[title="Details"]');
// Retrieves the icon element of the retrieved command button
var iconEle = commandButtonEle.querySelector('.e-icons');
// Custom icon class is added to this icon element based on row data
if (args.data["Freight"] > 25) {
iconEle.classList.add('custom-more');
} else {
iconEle.classList.add('custom-less');
}
} |
|
<style>
.custom-less:before{
content:'\e304';
}
.custom-more:before{
content:'\e306';
}
</style> |
That's great, just what I needed.
Thank you