How do I create a custom skuid component to contain multiple pre-defined skuid components?
Here is my attempt:
skuid.componentType.register('ccoptimize__script',function(element,xmlDef,component){
// Get properties and model
var scriptModelId = xmlDef.attr('scriptmodel'),
toggleVisible = xmlDef.attr('togglevisible');
var scriptModel = skuid.$M(scriptModelId),
scriptRow = scriptModel.getFirstRow();
var scriptLabel = scriptModel.getFieldValue(scriptRow, 'Name');
//Set value for default visibility
var toggleField = scriptModel.getFieldValue(scriptRow, 'Toggle_Visible__c');
if (toggleField !== toggleVisible) {
scriptModel.updateRow(scriptRow,{Toggle_Visible__c: toggleVisible});
}
// Define XML for our child components
var $xml = skuid.utils.makeXMLDoc;
var xmlPageTitle = $xml('[XML STUFF]');
var xmlFieldEditor = $xml('[ALSO XLM STUFF]');
// Make containers for our components
element.append($('<div id="scriptbuttons">'),$('<div id="scripttext">'));
skuid.component.factory({
xmlDefinition: xmlPageTitle,
element: element.children.scriptbuttons
});
skuid.component.factory({
xmlDefinition: xmlFieldEditor,
element: element.children.scripttext
});
});
All I’m getting for element when the page loads is:
<div id="2" data-rendered="true"> <div id="scriptbuttons"></div> <div id="scripttext"></div> </div>
What’s the proper way to accomplish this?