I wanted to create a control that would extract all of the dimensions from a data source, and then create a single string with comma separated values.
I started with the simple table sample and kept the following component:
<property | |||
id="column1" | |||
title="Column X" | |||
type="ResultCellList" | |||
group="DataBinding"> | |||
<option name="includeFormattedData" value="true"/> | |||
<option name="includeMetadata" value="true"/> | |||
</property> |
I then modified the afterUpdate function to:
this.afterUpdate = function() {
if(JSON.stringify(this.metadata()).length){
try{
for(i=1; i < this.metadata().dimensions[1].members.length-1; i++){
if(i==1){
commaStr = this.metadata().dimensions[1].members[i].text;
}
else{
tempStr=commaStr;
commaStr = tempStr + ', ' + this.metadata().dimensions[1].members[i].text;
}
}
alert(commaStr);
}catch(e)
{
}
}
};
This does give me the output that I want:
string_1, string_2, string_3, string_4, ...
My questions are:
- Currently, I have to assign a data source through Data Binding: Data Source and Column 1, in the Design Studio interface.
- I want to only assign the data source, since I am not showing the data selected in Column 1.
- I am using ResultCellList, should I be using ResultSet? If so, then how would my code change?
- Are there definitions somewhere that explains exactly how to use the ResultSet, ResultCellList, and others?
- After assigning the Data Source, the AfterUpdate function gets called. What is passed to the AfterUpdate function? Is there a way to access the data source and its contents in this AfterUpdate call?
Thanks,
Robert