How to create a UI-Only model in Javascript

  • 1
  • Question
  • Updated 2 years ago
  • Answered
Does anyone know how to create a UI-Only Model in JavaScript?  I'm adapting the tutorial linked here: http://help.skuid.com/m/11720/l/228794-dynamic-creation-of-models-and-components-with-javascript,  the line below creates a new model with a Salesforce datasource.  Any hep is greatly appreciated
var OppModel = new skuid.model.Model();
Photo of Adam Edmonds

Adam Edmonds

  • 454 Points 250 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

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

I'm not sure what the settings should be, but you can find out:
  • create a ui-only model in the builder
  • preview the page.
  • open the javascript console and use `skuid.model.map()` to view your model and see what the parameters are.
  • copy the relevant parameters into your javascript model creation.
Photo of Adam Edmonds

Adam Edmonds

  • 454 Points 250 badge 2x thumb
Thanks Matt.  Your instructions lead me to the line below.  I  thought had tried something like this in the past, but I must have left something out.  Thanks for pointing out the map feature.

var ds = new skuid.model.Model({dataSourceName:"Ui-Only", dataSourceTypeName: "Ui-Only"})
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,004 Points 20k badge 2x thumb
dataSourceName: "Ui-Only" is all that is needed. the Data Source Type is inferred from the Data Source.