Hi,
Is there any way to control the delete button which is displayed by using the {command: 'destroy',title:"Action", width:"20px",attributes: {"class": "delete-row"}
It is doing the necessary thing right, that is deleting a row, but i would like to control it such a way that if there's only one row remaining in that particular grid, it should alert or display a message saying that you will not be able to delete it.
If there are more than one rows then, its ok. But if there is only 1 row remaining, I wanted to handle this.
Can you please tell me a method for doing so?
Thank you.
7 Answers, 1 is accepted
In order to implement the behavior you can use a template and a custom command. In the custom command handler you can check if the conditions are met and use removeRow.
The following online example illustrates how you can use custom commands.
Regards,
Viktor Tachev
Telerik
Can you please provide a custom example to it?
I just tried providing template.. But didnt work..
I wanted the delete to not delete row if there's only one row remaining (In all other cases it should work as usual destroy command..).
I am able to access the no. of rows using $("#grid").data("kendoGrid").dataSource.total();
I have prepared a sample that illustrates the approach. Check the dojo example in the following link:
Regards,
Viktor Tachev
Telerik
Hi Viktor,
Thanks a lot for providing an example for illustrating the same.
I am glad that the sample is helpful to you.
Regards,
Viktor Tachev
Telerik
Hi Viktor,
How can hide the title or change? I want to remove this title or hide this title "an embedded page on this page says" ? How can achieved this?
Hello,
The confirmation in the previous dojo is the default browser dialog. If you would like to customize the confirmation dialog I suggest using the approach described in the following knowledge base article:
https://docs.telerik.com/kendo-ui/knowledge-base/custom-delete-confirmation-dialog
Regards,
Viktor Tachev
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.