Is it possible to control the destroy command button?

8 posts, 0 answers
  1. Stefan
    Stefan avatar
    29 posts
    Member since:
    Nov 2015

    Posted 09 Dec 2015 Link to this post

    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.

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2499 posts

    Posted 09 Dec 2015 Link to this post

    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!
     
  3. Stefan
    Stefan avatar
    29 posts
    Member since:
    Nov 2015

    Posted 13 Dec 2015 in reply to Viktor Tachev Link to this post

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

  4. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2499 posts

    Posted 14 Dec 2015 Link to this post

    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!
     
  5. Stefan
    Stefan avatar
    29 posts
    Member since:
    Nov 2015

    Posted 15 Dec 2015 in reply to Viktor Tachev Link to this post

    Hi Viktor, 

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

  6. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2499 posts

    Posted 16 Dec 2015 Link to this post

    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!
     
  7. Liton
    Liton avatar
    5 posts
    Member since:
    Feb 2020

    Posted 28 Aug 2020 in reply to Viktor Tachev Link to this post

    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? 

  8. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2499 posts

    Posted 01 Sep 2020 Link to this post

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

Back to Top