skuid.builder.core.Builder options parameter specification missing

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
I have read:

The specification of the full options I can choose for the builder is missing. More specifically for my case, the options I have in the propertiesRenderer. I need to add a field to the component properties where I can pass in a variable with the merge syntax, similar to the parameters field on a Page Include component. I only know I can make the property of type string, but it doesn't convert variables passed in. Is there a property type that allows me to do that?
Photo of Matthías Ragnarsson

Posted 4 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 50,372 Points 50k badge 2x thumb

We are working to document Builder properties, it's been on our backlog for a while and it looks like it's going to be front and center very soon.

In the meantime, you can have a property of type "template", and that will present the merge field picker, e.g.

var myProp = {
    id: "foo",
    type: "template",
    location: "attribute",
    label: "Foo!"

The location property here should be set to attribute as well, as type "template" can also be used to store the resultant template as the body of your XML node, which is probably not what you want here.

Now, in your Component's Runtime, in order for your variables to be converted, you will need need to process them through skuid.utils.merge, which takes a string of text that may contain merges, and inserts content into the merges based on the context you have available. For instance, if your Component relies on a Model, and you want to merge in some data from the first row in this Model, then you might have something like this:

   // Get a reference to the requested Skuid Model
   var model = skuid.model.getModel(xmlDef.attr('model'));
   // Get its first row
   var row = model.getFirstRow();
   // Merge foo in context of our row and model
   var foo = skuid.utils.merge('row',xmlDef.attr('foo'),{createFields:true},model,row);