To help determine when updates need to occur, i.e. when your data is 'dirty', you could set up some javascript to track changes to the data. This could be just an onchange() event for all of the editable inputs in the HTML form. You'd need a flag for each row that is editable on the page, and when the form is submitted, you only need to update the rows whose onChange flags are set. Again, not the greatest solution, but it should work.
I use the most powerful debugger available: print!