Widget with Option schema
How to Add Option Variables
Create New Widget with name=first
Click on "Open in Widget Editor"
Create New Widget with name=first
Click on "Open in Widget Editor"
Click "Edit Option Schema"
Name:Variable Name
Hint:Its just hint
Default Value: If the variable does not have value, then it will keep the default value for that widget instance.
After setting the variable, Widget options schema , will looks like below
Please make a note that we have used the variable name =table_name, which we need to use exact same in the widget instance.
Now Create a Page for this Widget...
Create Page
Open the Widget Instance and set the Widget Variable in "Additional options, JSON format" like below
{
"FIRST_VARIABLE_NAME":{
"value":"VALUE NAME",
"display_value":
},
"SECOND_VARIABLE_NAME":{
"value":"VALUE NAME",
"display_value":
}
}
Widget Sample Script, to access the Widget Options
We can access options in client script as well as server side script
Client Side: c.options.VARIABLE_NAME
Service Side: options.VARIABLE_NAME
Comments