How to Disable Custom Command Delete Button

1 Answer 34 Views
Button Grid
abdul
Top achievements
Rank 1
Iron
abdul asked on 27 Nov 2024, 11:01 AM

Hi,

I have a custom Command  delete button, I wanted to disable this button.

I tried the below code, but its disable pagination hyperlink numbers also.

 $(".k-button").addClass("k-disabled");

 

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 28 Nov 2024, 12:37 PM

Hi Abdul,

 

Thank you for writing to us.

You can achieve this requirement using the following approach:

$(".k-grid-remove-command").addClass("k-disabled");
The other option is this:
$(".k-master-row .k-grid-remove-command").addClass("k-disabled");
Do you find this answer helpful? Feel free to try both solutions and let me know what you think.

 

Regards,
Eyup
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

abdul
Top achievements
Rank 1
Iron
commented on 28 Nov 2024, 12:45 PM

Hi Eyup,

I tried both the approach, both are not working. The delete buttons are still enabled.

abdul
Top achievements
Rank 1
Iron
commented on 28 Nov 2024, 12:47 PM | edited

The Delete button is a Custom Command button

 columns.Command(command => command.Custom("Delete").Click("DeleteRecord")).Title("Action").Width(150).HeaderHtmlAttributes(new {style = "justify-content:center"});

Eyup
Telerik team
commented on 03 Dec 2024, 12:02 PM

Hi Abdul,

Yes, the snippets I suggested were rather for the standard Delete column.

Thank you for sharing the custom Delete command column definition. You can disable the buttons like this:

$(".k-grid-Delete").addClass("k-disabled");

You can find the entire sample here:
https://netcorerepl.telerik.com/GePGExvc00UPfjkm23

Tags
Button Grid
Asked by
abdul
Top achievements
Rank 1
Iron
Answers by
Eyup
Telerik team
Share this question
or