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

How to disable row based on one of the column's data values

1 Answer 630 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Catherine
Top achievements
Rank 1
Catherine asked on 02 Aug 2018, 04:00 PM

Hi, I'm looking for help disabling an entire rows edit abilities by using the value in one of the columns.

ex.

...

            columns.Bound(p => p.releaseState).Title("Release State");
            columns.Command(command => {command.Edit().Visible("isEditable(releaseState)");});

...

 

This does not work neither does isEditable(p.releaseState) or isEditable(Model.releaseState)...

Any help would be greatly appreciated.

1 Answer, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 05 Aug 2018, 08:26 PM
Hello Catherine,

You can use the Visible property by passing a script function name as an argument:
https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/columns.command#columns.command.visible

In your case, it will be something similar to this:
columns.Command(c => c.Edit().Visible("isEditable"));
JavaScript:
function isEditable(dataItem) {
    return dataItem.ShipName === "ShipName 3";
}

I hope this will prove helpful.

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Catherine
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or