Hi
I have a grid set with editable mode "incell". I have a create button at the top of the grid in the toolbar. When I create a new record, I'd like to initialize the values (i.e. provide defaults) of the new record.
I have tried setting the values of the model in the edit event using:
Although this presets the value when I activate the field editors by tabbing to these fields, it does not display the value until the cell editor is displayed. This is confusing for the user.
I've also tried setting the text value of the new row's <td> attribute using:
This sets the value as desired but for some reason renders the cell un-editable!
How can I provide defaults for the new record the user is creating?
Thanks
I have a grid set with editable mode "incell". I have a create button at the top of the grid in the toolbar. When I create a new record, I'd like to initialize the values (i.e. provide defaults) of the new record.
I have tried setting the values of the model in the edit event using:
edit: function(e) {
if (e.model.isNew()) {
e.model.QuantityAvailable = 1;
}
}
Although this presets the value when I activate the field editors by tabbing to these fields, it does not display the value until the cell editor is displayed. This is confusing for the user.
I've also tried setting the text value of the new row's <td> attribute using:
edit: function(e) {
if (e.model.isNew()) {
e.model.QuantityAvailable = 1;
var row = e.container.parent();
row.find("td:nth-child(2)").text(e.model.QuantityAvailable);
}
}
This sets the value as desired but for some reason renders the cell un-editable!
How can I provide defaults for the new record the user is creating?
Thanks