grid.dataitem("tr:eq(1)").set("Duration", value)
and as well as getting item by uid and doing the same but neither work. Is this possible with a non-editable field? Looking at the html there doesn't appear to be a control name (i may be wrong) so is the method to find the column cell and just update the content (though i'm not sure how to do this)?
6 Answers, 1 is accepted
I already addressed this query in the support ticket you opened, but I will share my reply here as well.
This behavior is expected, because setting the field as non-editable prevents it from being updated through the set method as well. You can use the assignment operator and then manually trigger the change event as a workaround. For example:
item.Duration = value;
item.trigger(
"change"
);
Regards,
Alexander Popov
Telerik
This is exactly what i need with just one difference...instead of knowing the fieldname (Duration).
item.Duration = value
i have the field name in a variable so how can i set it?
var x = "Duration";
item.x = value
item.trigger("change")
You can use the bracket object notation:
var field
=
"Duration"
;
item[field] = value;
item.trigger(
"change"
);
Regards,
Alexander Popov
Progress Telerik
Firstly, Thanks for the quick response.. and secondly, this logic only works on columns where [editable: true] . Infact even dataItem.set() also works on those columns where editable is set to true.
The columns that have editable set to false do not budge...(I am setting editable property in the model.)
Also,on another suggestion from telerik I set
editable: function (dataItem) {
return false;
}
in the model then there is invalid left-hand side assignment error.
fields["md" + mapdetailId + "rt" + resulttypeId] = {
editable: function (dataItem) {
return false;
}
};
Thanks for a quick response Alexander. This logic is only working on columns that are set to editable in the model but not on non-editable columns. (I am setting editable property in the model not in columns as they donot work when i define in columns).
Also on another suggestion from telerik i set field in model as follows
fields["md" + mapdetailId + "rt" + resulttypeId] = {
editable: function (dataItem) {
return false;
}
};
instead of fields["md" + mapdetailId + "rt" + resulttypeId] = {
editable: false
};
Then it gives the error: Invalid left-hand side in assignment
I am not sure what the exact scenario is. Would you please share a runnable Dojo example where it's replicated?
Regards,
Alexander Popov
Progress Telerik