We have created a Classic UI Dialog and Touch UI Dialog with a drop down widget which displays dynamic values. We have used optionsProvider property for populating these values in classic ui and datasource in touch ui.
This works fine; However, after we select the drop down value in Classic ui and open the dialog in touch ui mode, touch ui dialog does not show the selected value in classic ui dialog. Same is the case when we try to save the value in touch ui dialog and open classic ui dialog. Moreover, irrespective of the fact selected values getting saved in page's component node, these dialogs not able to pick the value from the saved property when saved in other dialog mode.
Is this happening because of listeners since I am able to fetch the drop down value in other component with static values ?
Please help me with this issue.
Classic UI Attribute,
<productCategory
jcr:primaryType="cq:Widget"
fieldLabel="select Product Category"
name="./productCategory"
optionsProvider="function(){ 
 var categories = []; 
 var tags = '/etc/tags/mecommerce/categories'
 var url = CQ.HTTP.noCaching(tags+'.infinity.json'); 
 var categoriesList = CQ.HTTP.eval(url); //DAM Url
 
for(var name in categoriesList){ //Looping the node structure

/*
Each image will have the meta data in it's jcr:content. This meta data consists of many values like, its 
type, size, fileFormat etc., We are checking the format is image or not and adding
*/		
 if(categoriesList[name]['jcr:title']){
			var list = {}; 
 // each option should contain text and value
 list['text'] = categoriesList[name]['jcr:title']; 
 list['value'] = categoriesList[name]['jcr:title']; 
			categories.push(list); 
 } 
 } 
 return categories; // returns the JSON
}"
type="select"
xtype="selection"/>
Touch UI Attribute,
<productCategory
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/select"
fieldLabel="select Product Category"
name="./productCategory">
<datasource
jcr:primaryType="nt:unstructured"
sling:resourceType="/apps/mecommerce/commerce/components/content/categoryStandardProductDetail/datasources/categories"
addNone="{Boolean}true"/>
</productCategory>
Issue is with datasource. When the value is adding to map, the key and value are not same. After Correcting the issue got resolved.
Modified as,