Hi, I want to change the color of toolbar item according to their functions. Example: add = red, edit = blue... Can yo
|
// Grid’s dataBound event handler
onDataBound() {
// This event will be triggered each time the grid data is modified, so flag variable is used so that this case is executed only on Grid initial render
if (this.initialFlag) {
// Toolbar item elements
var toolbarEles = (this.gridObj.toolbarModule.toolbar as any).tbarEle;
toolbarEles.forEach( ele => {
// Custom class is added to the toolbar item’s button element based on its text content
// You can customize this condition as required
if (ele.innerText === "Add")
ele.querySelector('button').classList.add('custom-add')
else if(ele.innerText === "Edit")
ele.querySelector('button').classList.add('custom-edit')
else if(ele.innerText === "Delete")
ele.querySelector('button').classList.add('custom-delete')
})
this.initialFlag = false;
}
} |
|
.custom-add {
background-color: red !important;
}
.custom-edit {
background-color: blue !important;
}
.custom-delete {
background-color: yellow !important;
} |
|
#Normalgrid_add {
background-color: red !important;
}
#Normalgrid_edit {
background-color: blue !important;
}
#Normalgrid_delete {
background-color: yellow !important;
} |