Focal Point
Format columns in an ibiDataGrid [SOLVED]

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/178107634

May 07, 2010, 12:07 PM
Tim Easley
Format columns in an ibiDataGrid [SOLVED]
I haven't had any luck finding documentation on this, the wf_flex.pdf on the IBI site only has generic description of properties and no examples.

How do I format columns in an ibiDataGrid Flex app? I tried formatting the column in the fex that creates the xml but that didn't help.

I have several numeric columns that I want to format as "D9C" (in fex speak). They appear with comma's and two decimal places in Flex output.

This message has been edited. Last edited by: Tim Easley,
May 07, 2010, 12:43 PM
Darin Lee
Try formatting with P9C in the fex and see if that works. Packed performs rounding and subsequent decimal notation a little nicer than Decimal sometimes.

There are number and decimal formatters available in actionscript that can also be used. I'll have to look for an example.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
May 07, 2010, 12:46 PM
Darin Lee
You can add
<mx:NumberFormatter id="num" precision="0" rounding="up" decimalSeparatorTo="."
	        thousandsSeparatorTo="," useThousandsSeparator="true" useNegativeSign="true"/>


and then use a function to reformat that column:
num.format(object)


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
May 12, 2010, 03:50 PM
Tim Easley
I tried formatting in the fex and it did not seem to work at first, but when I looked at it again the following day it was working. Maybe the data was cached or I did not save when I thought I had.

So now the number is formatted D9C but is left justified. Apparently, the ibiDataGrid doesn't understand the text/left, numeric/right default alignment I take for granted in any other output format.

I don't think that adding alignment in the fex will help since the xml output isn't going to care about the stylesheet but I'll give it a go anyway.

Thanks for your help.

This message has been edited. Last edited by: Tim Easley,
May 12, 2010, 04:22 PM
Darin Lee
You are right - the liagnment in the data grid has nothing to do with the fex , the XML, or stylesheets. It's all handled through properties in Flex. Add an ibiColumnStyle section to your datagrid to adjust the alignment (and other properties) of individual grid columns. You need a {} line for each column in your grid.

<ibi:ibiColumnStyle>	
    <![CDATA[	
       	{width:  90; textAlign: left;},	
	{width: 305; textAlign: right;},
         {width:  80; textAlign: center;}
             ]]>	
</ibi:ibiColumnStyle>



Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat