This is a migrated thread and some comments may be shown as answers.

Is it possible to control the destroy command button?

7 Answers 2174 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stefan
Top achievements
Rank 1
Stefan asked on 09 Dec 2015, 06:52 AM

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

Sort by
0
Viktor Tachev
Telerik team
answered on 09 Dec 2015, 04:41 PM
Hi Stefan,

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
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Stefan
Top achievements
Rank 1
answered on 13 Dec 2015, 12:36 PM

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();

0
Viktor Tachev
Telerik team
answered on 14 Dec 2015, 02:18 PM
Hello Stefan,

I have prepared a sample that illustrates the approach. Check the dojo example in the following link:



Regards,
Viktor Tachev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Stefan
Top achievements
Rank 1
answered on 15 Dec 2015, 09:08 AM

Hi Viktor, 

Thanks a lot for providing an example for illustrating the same.

0
Viktor Tachev
Telerik team
answered on 16 Dec 2015, 02:50 PM
Hi Stefan,

I am glad that the sample is helpful to you.

Regards,
Viktor Tachev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Liton
Top achievements
Rank 1
Veteran
answered on 28 Aug 2020, 02:06 PM

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? 

0
Viktor Tachev
Telerik team
answered on 01 Sep 2020, 09:32 AM

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/.

Tags
Grid
Asked by
Stefan
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Stefan
Top achievements
Rank 1
Liton
Top achievements
Rank 1
Veteran
Share this question
or