When I add a new record to the detail grid in a master/detail grid, I see an ajax call for each exisitng record: ie, if there are 4 records already in the detail grid then there will be 5 posts to the new datail method followed by 5 calls to the show details method. This seems to be both unneccessary and a waste of my server resources. I also have to test for an existing detailId before attempting the insert into the database so that I do not get duplicate records in the databse.
How can I limit it to just the one insert call for the new record followed by just one grid refresh call.
Here is my js event handler for the grid edit event:
How can I limit it to just the one insert call for the new record followed by just one grid refresh call.
Here is my js event handler for the grid edit event:
/**
* edit event handler of the curent comments grid.
* Bound at design time by the grid configuration.
*
* @param {event} e
*/
function commentsEdit(e) {
if (e.model.isNew()) {
/**
* get the participant_hotalert_id from parentData and set it into the model
*/
e.model.set('participant_hotalert_id', parentData.participant_hotalert_id);
/**
* get the current status from parentData and set the status of the new comment.
* N.B.
* You have to set the popup window element first or you CANNOT set the value in the model.
* Both have to be set so that the new comment gets the current status when the user does not change it.
*/
var status = parentData.status;
e.container.find('select').val(status);
e.model.set('status', status);
}
}