When editing a grid, how do I disable specific fields by row? Kendo UI ASP.Net MVC wrapper -
i have kendo grid using asp.net mvc wrappers , has multiple columns (say col 1 , 2). grid set incell editing mode. columns 1, 2 need able edited (or preventing editing) based off values of each other specific row.
for instance, if column 1 value true column 2 allowed edited. if column 2 value false, column 2 not allowed edited.
any ideas?
i found similar example using client side extensions.
when editing grid, how disable specific fields row?
is there similar way using asp.net mvc wrappers?
we ran across similar issue , found following solution. might not right way it, seems work disabling field when row existing , enabling when new. logic should able swapped logic need.
in kendo mvc bindings. "disableonedit" name of javascript function call when cell goes edit mode.
@(html.kendo().grid<yourmodel>() .name("grid") ... .events(events => events.edit("disableonedit")) ...
in javascript:
function disableonedit(e) { if (e.model.isnew()) { // leave editable if row new. } else { // disable editor element in row if row exists. var select = e.container.find('input[name=element]').data('kendodropdownlist'); select.enable(false); } }
this approach borrowed kendo grid edit docs
see other answer mentioned different conditions.
thanks chris finlayson pairing on this.
Comments
Post a Comment