Model field value and display are not in Sync

  • 1
  • Question
  • Updated 4 weeks ago
  • In Progress
I have a checkbox field in a model and all I wanted was to display that field (I have many other fields on the page from the model which seem to work fine).But the slider does not correctly depict what is in the model.
I tried to create a button and render the button based on the value of the said field and it won't work either. If I use skuid.model.getModel('MODELNAME').getFirstRow(); I can see correct value (as stored in salesforce).

Any insight would be appreciated. Thanks!

SKUID version (Salesforce): 8.15.17
This is a SKUID mobile app



Photo of Sree

Sree

  • 110 Points 100 badge 2x thumb

Posted 4 weeks ago

  • 1
Photo of Clark Cregg

Clark Cregg, Solutions Engineer

  • 882 Points 500 badge 2x thumb
Hello Sree,

Could you provide some more details on what is being built? Are you trying to show details for a record in a sliding panel? What is your model/action configuration for this?

Thanks,
Clark
Photo of Sree

Sree

  • 110 Points 100 badge 2x thumb
Clark,
I am trying to show couple of checkbox fields in a deck. 

I can see that when query the model in console using 
> skuid.model.getModel('MODELNAME').getFirstRow();
I see that values for the fields as 
{
............ (rest of the fields omitted for brevity)
...........
Paper_Invoice_Requested__c: "true"
Ready_for_IL_Agreement__c: "false"
.................
......
}

but on the UI, it is not displaying correctly even though I am displaying from the same model





Photo of Sam Becker

Sam Becker

  • 1,742 Points 1k badge 2x thumb
if you get the id of the deck component type skuid.component.getById('ComponentID').render() in the console. does it then display the correct value?
Photo of Sree

Sree

  • 110 Points 100 badge 2x thumb
Sam,
when I type skuid.component.getById('sk-AgvZD-759').render(); in the console, the model values contain correct values
Photo of Sam Becker

Sam Becker

  • 1,742 Points 1k badge 2x thumb
Did it display the correct values on the UI? the xxx.render() method should force your component to re-render and pull the values from the model. 
Photo of Sree

Sree

  • 110 Points 100 badge 2x thumb
No, it did not display correct values on the UI even after I called skuid.component.getById('sk-AgvZD-759').render(); from the console.
Photo of Jer Carpenter

Jer Carpenter, Employee

  • 160 Points 100 badge 2x thumb
Sree,

Is there anything running on page load (or some other interaction) that changes that value from what's actually stored?

Does the checkbox toggle when you interact with it? After it's been toggled off and on, does skuid.model.getModel('MODELNAME').getFirstRow(); reflect the toggled value?
Photo of Sree

Sree

  • 110 Points 100 badge 2x thumb
Jer,

Initially the model would be empty, I am populating the model based on user actions. When the model is populated, these fields are supposed to reflect the change, but they are not. I guess the fields on the UI don't know that the model is being populated?

Once I interact with the toggles, I have a save button which saves the model (to salesforce), it shows correct values. But first time around, they do not reflect correct values. 

I have various other fields(Text fields) on the page from same model, they are showing correct values.