Snippet Update of UI Model Fields

  • 1
  • Problem
  • Updated 1 year ago
  • Solved
  • (Edited)
Hi, 

In earlier versions of Skuid, before 9.5, I could update fields in a UI Only model via a snippet. I could update fields in a snippet via the same updateRow function that we use for regular saleforce models. Now, and I've tried in both 9.5.12 and 10.0.4, I can no longer do this.  Here is a bit of the code that makes a new row in the UI only model (ConfigKitGroup1SelectorUI) and update the filed counter on it. 

var $ = skuid.$;
var models = skuid.model.map();
var UISelectors = models.ConfigKitGroup1SelectorUI;

var Qty = 5
var count = 1;

while (Qty > 0){
    console.log('Adding Row to Group 1');
    var newRow = UISelectors.createRow({doAppend : true});
    UISelectors.updateRow(
    { Id: newRow.Id },
   {
        Counter: count
    }
    );
    Qty--;
    count++;
}


When running this it makes the rows, but doesn't update the counter field with the value. I've worked around this issue with a simple index reference but I'm wondering why I can no longer do something like this.


Andy
Photo of Andy Shipsides

Andy Shipsides

  • 430 Points 250 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Andy,

Try the field updates as a single object in the first argument of the updateRow() call, like so:

UISelectors.updateRow({ 
        Id: newRow.Id,
        Counter: count
    });