Question

I guess its just due to my lake of jquery knowledge but ill lay down the details:

I have a local data grid, which rows are inline edited. the data is received from the server by a json object. there also some depended columns which come options also arrives from server with json. under the grid i have 3 buttons (Add, Submit and Delete). when the Submit button is pressed the grid is converted to json object and sent to the server to update the application. in order to save an edited row the user need to press enter, but my users have a tendency to forget this little key and then the data entered is the html for each of the columns.

My question is how can i simulate the enter click to save the row and lose edit focus of row, when Add and Submit buttons are clicked.

Was it helpful?

Solution

Problem solved:

not the most efficient but by saving all rows i assure always edited rows will be saved without the complication of sending key stroks. sometimes the easy way is the direct way.

var rowIds = $('#list').jqGrid('getDataIDs');
for(idIndex = 0; idIndex < rowIds.length; ++idIndex){
     jQuery("#list").jqGrid('saveRow',rowIds[idIndex]); 
}

By getDataIDs i get all rows ids and then iterate on them saving them. I hope its helps others 2 :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top