I have a column with a Command Button
<e-column field="Commands" headerText="Details" width="125" :commands="commands"></e-column>
commands: [ { buttonOption: { content: "Details", cssClass: "e-warning custombutton" } }],
Is there a way to hide the button if a value in that row a certain value such as.
:valueAccessor = hideButton
hideButton: function(field, data, column){
if(data("LastName") = "Smith"){
//hide button
}
}
|
<ejs-grid
ref="grid"
id="Grid"
:dataSource="data"
:allowPaging="true"
:pageSettings="pageSettings"
:editSettings="editing"
:toolbar="toolbar"
:rowDataBound="rowDataBound"
:commandClick="commandClick"
>
. . . . . .
</ejs-grid>
rowDataBound: function (args) {
if (args.data.CustomerID === "VINET") {
args.row.querySelectorAll(".e-unboundcelldiv")[0].style.display =
"none";
}
},
|
Thank you. That should work fine.
Hello,
I have the same problem but I would like hide button when I'm in th edit mode.
Do you have the solution ?
Hi William Morgenweck,
Thank you for reaching out to us.
You would like to hide a command column button when you are editing the row (in edit mode). We can fulfill this requirement by utilizing the actionComplete event. We apply a "display: none" style to the command buttons based on certain conditions.
Please refer to the below sample, code snippet for more information.
Code sample :
|
App.vue
<ejs-grid :dataSource="data" :allowPaging="true" :pageSettings="pageSettings" :allowSorting="true" :editSettings="editSettings" :actionComplete="actionComplete" > ……. </ejs-grid>
……..
actionComplete: function (args) { if (args.requestType == 'beginEdit') { args.row.querySelectorAll('.e-unboundcelldiv')[0].style.display = 'none'; } },
|
Sample : Ohtk8c (forked) - StackBlitz
Please get back to us, if you need further assistance
Regards,
Johnson Soundararajan S