change cell styling in KendoGrid

2019-08-28 21:14发布

问题:

Just discovered the KendoGrid and was trying to change the style of an individual column(cell) after changing another cellvalue. For example I have a grid with a shipname and shipcity column. Suppose I have a business rule that says :

'Make shipcity cell value disabled when the shipname on the same row has the same value'

I found this sample which uses the blur event which I probably use, what would be a good way of implementing this rule?

Also nice to know your opinion in relation to asp.net mvc integration.

jsfiddle link:http://jsfiddle.net/dingen2010/begjT/1/

回答1:

Updated the link:

You can try the updated fiddle example here



回答2:

Basically conditional editor templates are not supported out of the box. You have two options.

Either use the edit event of the Grid find the editor inside e.containder and disable it the way it needs to be (if using Kendo widget use the enable(false) method, or add the readonly attribute if regular input).

The other options is to define custom editor like demonstrated in this JsBin example.