skuid.builder.core.Builder options parameter specification missing

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
I have read:
http://help.skuidify.com/m/11720/l/129359-create-a-skuid-component
http://help.skuidify.com/m/11720/l/209409?data-resolve-url=true&data-manual-id=11720

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

  • 48,984 Points 20k badge 2x thumb
Matthias,

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:

skuid.componentType.register('mypack__mycomponent',function(element,xmlDef,component){
   // 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);
   element.append(foo);
});