Script looping through rows that only processes unsaved records

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I have a scrip that iterates through a series of rows in a table and updates pricing based upon a few modifiers. It can take awhile to iterate through every row, so I was wondering if there was a way to only process the rows that have changed.. is there a way to check for this in my each loop?

Here's the loop code..

var quoteLines = skuid.model.getModel('QuoteLineList');
if ( > 0) {
 $.each(, function (i, row){  
  // do stuff
Photo of Oliver Sinfield

Oliver Sinfield

  • 922 Points 500 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 52,340 Points 50k badge 2x thumb
Official Response
The supported way to check this is to use model.isRowChanged(row), like this:

var quoteLines = skuid.model.getModel('QuoteLineList');
var quotes = quoteLines.getRows();
if (quotes.length > 0) {
   $.each(quotes, function (i, row){  
      // Only proceed if the row has unsaved changes
      if (quoteLines.isRowChanged(row)) {
          // Do Stuff