ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: bmais on September 27, 2013, 09:43:24 pm

Title: Batch Editing - how to update grid recIndx after database insert
Post by: bmais on September 27, 2013, 09:43:24 pm
When I create a new record in the grid it does not have a record_id.  My database insert statement creates and returns it.  How do I update the grid with that record_id?

Note: I do not want to refresh the entire grid - only the new record.
Title: Re: Batch Editing - how to update grid recIndx after database insert
Post by: paramvir on September 27, 2013, 10:58:33 pm
Bill

1) keep a reference to the new added record on the client side using rowIndx

2) a) Send the rowData of new record to the server using $.ajax
    b) and get the record_id of the new record (as ajax response) from the server.

3) update the record_id of the client side record using dataModel.data[rowIndx][dataModel.recIndx] = record_id
http://paramquery.com/pro/api#option-dataModel-data (http://paramquery.com/pro/api#option-dataModel-data)

4) use refreshRow() to display record_id in the view 
http://paramquery.com/pro/api#method-refreshRow (http://paramquery.com/pro/api#method-refreshRow)


Notes:

4th step is optional and required only  if recIndx column is visible in the grid.
If you are doing remote paging, then use rowIndxPage instead of rowIndx