Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

createComponent(meta, dataSource, index, additionalPropsToComp)

Updated on July 20, 2021

Creates a component whose type is provided as part of the meta object and uses the other parameters to resolve the properties and get the context.

Returns

A newly created instance of a component.

Parameters

NameTypeDescriptionRequired
metaobjectThe metadata of the component to be created.
dataSourcestringThe source reference to the Redux store. This contains properties that will be input to the created component.
indexstringIf the dataSource is a list, this is the index position that will be input to the created component.
additionalPropsToCompobjectThe additional properties that are passed as input to the created component apart from the configured values.

Usage example

In this example, a button is created with a label that is derived from the first index position of the D_Employees.pxResults list.

getPConnect().createComponent({
 type: "Button",
 config: {
   label: "@P .FirstName"
 }
},
"D_Employees.pxResults",
1,
{
 active: true
}
);

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us