Author Topic: Need to Refresh Entire Grid After Save?  (Read 5623 times)

jax

  • Newbie
  • *
  • Posts: 16
    • View Profile
Need to Refresh Entire Grid After Save?
« on: June 18, 2014, 10:32:47 am »
After I click Accept changes, make an ajax call to save the data, the dirty rows/cells are reset back to their original values instead of the newly saved values. The code examples in the demos show that the entire grid is reloaded with data stored in session. Why would you want to reload the entire grid when you have maybe only updated one cell? Is there not a way to leave the grid with newly saved data and not have to reload the entire again?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 5791
    • View Profile
Re: Need to Refresh Entire Grid After Save?
« Reply #1 on: June 19, 2014, 06:55:56 am »
reloading the grid data makes sense if multiple users are working on the same grid or you want to keep the logic of computing dependent cells on server side.

But it's entirely upto you whether you reload the data after accept changes and you can skip it.

jax

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Need to Refresh Entire Grid After Save?
« Reply #2 on: June 20, 2014, 07:07:28 am »
After I save changes, if I do not reload the entire grid, then the dirty cells are reset back to the original values, and it forces me to have to reload the grid. I do not want to reload the grid again and I do not want the dirty cells to reset the data after I save, how do I prevent this?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 5791
    • View Profile
Re: Need to Refresh Entire Grid After Save?
« Reply #3 on: June 23, 2014, 09:41:57 am »
Either return the changes you want to commit from server side script

or

change $grid.pqGrid("commit", { type: 'update', rows: rows }); to $grid.pqGrid("commit", { type: 'update' }); in success callback.

line number 60 of this demo http://paramquery.com/pro/demos/editing_batch