Sunday, October 9, 2016

For a component having multiple widgets with same structure but different name and save locations :

To use the same cq:WidgetCollection for them , You need to use xtype : cqinclude for that and add a property with name path and value  as a "infinity.json" path to the common widget like :

/apps/........./widgetname/items.infinity.json

For each item in common widget create a listeners node  with primary type as "nt:unstructured".

In the listeners node add the following properties :

added : function(object,container,index){for(item in object.items.items){object.items.items[item].name=object.items.items[item].name.replace("widget name",container.name)}}


beforeadd: function(object,container,index){object.initialConfig.name =  object.initialConfig.name.replace("widgetname",object.ownerCt.name);object.name =  object.name.replace("widgetname",object.ownerCt.name);object.optionsConfig.name =  object.optionsConfig.name.replace("widgetname",object.ownerCt.name);
}

You would be able to use same widget at multiple places like a include file without installing any extra plugin.

0 comments:

Post a Comment

Powered by Blogger.

Followers

Best Price Amazon Portal

Amazon Best Offers