Skip to content

setComponentProps

Updated pdexter 2023-11-01

Sets a property of a component, such that the display is rendered directly.

Applies only to certain properties, which have been prepared by the component developer.

See below for a (growing) list of properties applicable.

Syntax

ft3.setComponentProps( fieldName, componentType, { property : value , etc })

**

Part Description
fieldName Name of the field to be changed.
Corresponds to the "name" property in the template configuration.
componentType Type of the component being modified.
Corresponds to the "componentName" in the template configuration.
property Name of the property to modify.
value Value to assign to the property.

Example

// Modify panel to not collapsed.
ft3.setComponentProps('panelMain', 'sc-panel-collapse', {
    'wrapPanelCollapsed':false
});  

List of applicable properties

template

Applies to: sc-data-tables

Sets the template array.

Example

// Assuming docs = array of template documents to apply

let childSelections = docs.map(doc => ({
    "name"          : doc.name,
    "templateId"    : doc.documentId,
    "default" : {
        "assetRel" : "documentId"
    }));

ft3.setComponentProps("customFormGrid1", "sc-datatables", {
    "template": childSelections
});

wrapPanelCollapsed

Applies to: sc-panel-collapse

Modifies an sc-panel-collapse to be collapsed or not.

Examples

// Modify panel to not collapsed.
ft3.setComponentProps('panelMain', 'sc-panel-collapse', {
    'wrapPanelCollapsed':false
});  
ft3.setComponentProps("test", null, {
    label: "Updated Label",
    fullWidth: true,
    mandatory: true
});

ft3.setComponentProps("banner", "re-banner-warning", {
    color: "pink",
    fullWidth: true
});