Reputation: 485
This is my schema:
id: 'EntryCode',
fields: {
EntryCode: {editable: true, validation: {required: true}, nullable: true},
width: {editable: true, validation: {required: true}, nullable: true},
length: {editable: true, validation: {required: true}, nullable: true}
}
I want that the EntryCode will be editable just at create option, while at update it won't be editable.
How do I achieve this goal without templates?
Upvotes: 0
Views: 1848
Reputation: 485
Because I'm using editable: inline I've to find the cell and replace its content as follow:
edit: function (e) {
if (!e.model.isNew()) {
e.container.find('td:eq(0)').text(e.model.EntryCode);
}
}
to learn more see this question.
Upvotes: 2
Reputation: 18402
In the grid's edit event, check e.model.isNew()
, and do grid.closeCell()
, e.g.:
edit: function (e) {
var fieldName = e.container.find("input[name]").attr("name");
if (fieldName === "EntryCode" && !e.model.isNew()) {
this.closeCell();
}
}
(demo in which the ProductID field is editable for the third (new) row, but not for the first two rows)
Upvotes: 0