I have a question on how to implement the readonly on edit in kendo UI. see below for detailed explanation
I have the following Fields:
FirstName (editable on create) (editable on edit)
LastName (editable on create) (editable on edit)
UserName (editable on create) (readonly on edit)
Email (editable on create) (editable on edit)
TelephoneNumber (editable on create) (editable on edit)
PreWin2KUserName (not editable on create)(readonly on edit)
Using the Kendo UI Grid Reference Link http://demos.kendoui.com/web/grid/editing-inline.html
plus this to implement http://www.kendoui.com/forums/ui/grid/making-column-as-readonly-on-update-and-editable-on-insert-in-grid.aspx
k-button and/or . k-button-icontext) to set readonly or disabled. The toolbutton works, but the in-row Edit and Delete buttons may not be changed (always clickable). Do you have any trick to achieve it?
data("kendoGrid"); $grid.dataSource.at(0). fields["cell"]. editable = false; Save this answer.
You could use the edit event of the Grid. If the model is not new i.e. the user is editing (not creating) the record you attach the readonly attribute to the desired input element.
$('#yourGrid').kendoGrid({
// ...
edit: function(e) {
if (!e.model.isNew()){
// make sure the UserName id selector is correct in your code
// (it should be, for a regular text input)
$('#UserName').attr('readonly', 'readonly');
}
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With