I am creating multiple select list item. Now as per specifications, optiondataSource doesn't work with selectItem with "multiple" = true.
So what I am doing is calling fetchData explicitely and on its call back creating an array of Object and passing it to "setValueMap()" method of the selectItem.
I am having two separate fields for display and value.
issue here is that after i set the Array of object with two attributes I see following in select list.
[object][object]
[object][object]
[object][object]
rather than display value only.
here are the code details.
Dynamically create array and set value map.
See attachement for the select list generated.
Any pointers?
Thanks
So what I am doing is calling fetchData explicitely and on its call back creating an array of Object and passing it to "setValueMap()" method of the selectItem.
I am having two separate fields for display and value.
issue here is that after i set the Array of object with two attributes I see following in select list.
[object][object]
[object][object]
[object][object]
rather than display value only.
here are the code details.
Code:
{name: "searchFieldCountry",align: "right", defaultValue: "<b>Countries</b>", type:"select",
height:54,showTitle : false,rowSpan : 3, multiple:true,
valueField:"isoCode",displayField:"name"
},
Code:
function callBackCountryDSFetchData(data){
var dataArr = new Array();
if(data != null && typeof data != 'undefined'){
//alert('here');
for(var k = 0; k< data.length ; k++){
var obj = {};
obj.isoCode = data[k].isoCode;
obj.name = data[k].name;
dataArr[k] = obj;
}
//alert('1');
myViewSearchForm1.getItem("searchFieldCountry").setValueMap(dataArr);
// alert(dataArr[0].sectorItemId + '-' + dataArr[366].sectorItemName );
}
}
Any pointers?
Thanks
Comment