However the tweaks I am going to mention are simple and can be used to get this to work. After the tweaks don't forget to build the datavisualization.swc using the steps I have described in one of the earlier posts.
Modifing OLAPCell.as file : Modify the constructor to set a formatted value into the _formattedValue property
public function OLAPCell(value:Number, formattedValue:String=null)
{
_value = value;
_formattedValue = insert any custom formatting logic using value ;
}
Modify OLAPDataGrid.as : Somewhere around line 769 we can find the following line
label = cell && !isNaN(cell.value) ? String(cell.value) : defaultCellString;
Modify this to read as follows
label = cell && !isNaN(cell.value) ? String(cell.formattedValue) : defaultCellString;
Build the swc and use it in your app to get custom formatting. Of-course some more tweaking it required to make this generic and supply a Flex formatter directly to OLAPDataGrid. I am sure it can be easily figured out !
7 comments:
miHow can I have the sources of datavisualization.swc to change the class and OLAPDatagrid.as OLAPCell.as and compile again? Contents I could the way to do the test .... thanks
I have explained where to find the source here
And how to build it after making changes here
Sreenivas
would make the formatting of the values of type pivotcomponent with olapdatagrig, simple ..?
NumberFormatter id="fmtNumber" precision="2"
I know this is way off subject, but here goes..
I'm having some really weird issues with populating an advanceddatagrid with xmlList (quoteXMLList) data. Here is my situation. I've got an xmllist that, when looking at one entry (xmlList[0]), has xml looking like this.
[response]
[cost]
[totalCost]20[/totalCost]
[/cost]
[/response]
Now I'm trying to get totalCost as a datafield and for it to show up in a adg column. So I tried something like this
[mx:AdvancedDataGrid editable="false" width="100%" height="100%" variableRowHeight="true" id="quoteDataGrid" dataProvider="{this.quoteXMLList}"]
[mx:columns[
[mx:AdvancedDataGridColumn dataField="cost.totalCost" headerText="Total Cost" /]
But nothing shows up. So, I changed my dataprovider to this.quoteXMLList.cost and put dataField="totalCost" and it shows up fine. But I can't do that cause I have more info I need to gather for other columns that is in different areas of the xml in the current xmlList. So, can you not put e4x notation in datafield, if not what do I do here? Thanks in advance.
You can try using what is described here http://flexpearls.blogspot.com/2008/01/extending-dgcolumn-and-adgcolumn-to.html or use a custom itemRenderer for that column and access and display the 'totalCost' field using the data member.
Many institutions limit access to their online information. Making this information available will be an asset to all.
Custom Paper Writing
Post a Comment