Share on Google+Share on Google+

Style in AdvancedDataGrid

Advertisement
We use a inline style for AdvancedDataGrid. In this example you can see how we can use a style in AdvanceddataGrid control.

Style in AdvancedDataGrid control:

We use a inline style for AdvancedDataGrid. In this example you can see how we can use a style in AdvanceddataGrid control.

Example:

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx"

minWidth="955" minHeight="600">

<fx:Script>

<![CDATA[

import mx.collections.ArrayCollection;

[Bindable]

private var student:ArrayCollection = new ArrayCollection([

{Course:"Course", children: [

{CourseName:"B.Sc.", children:[

{Branch:"Physics", Girls:60, Boys:120, TotalStudent:180, PASSinper:98.0, FAILinper:2.0},

{Branch:"Chemistry", Girls:100, Boys:50, TotalStudent:150, PASSinper:97.0, FAILinper:3.0},

{Branch:"Mathematics", Girls:50, Boys:150, TotalStudent:200, PASSinper:98.5, FAILinper:1.5}]},

{CourseName:"B.tech.", children:[

{Branch:"CS", Girls: 45, Boys:75, TotalStudent:120, PASSinper:99.0, FAILinper:1.0},

{Branch:"IT", Girls: 55, Boys:65, TotalStudent:120, PASSinper:99.5, FAILinper:0.5},

{Branch:"EC", Girls: 25, Boys:95, TotalStudent:120, PASSinper:96.7, FAILinper:3.3},

{Branch:"EI", Girls: 40, Boys:80, TotalStudent:120, PASSinper:95, FAILinper:5},

{Branch:"Mechanical", Girls:10, Boys: 80, TotalStudent:90, PASSinper:97.5, FAILinper:2.5},

{Branch:"Civil", Girls: 15, Boys:45, TotalStudent:60, PASSinper:92, FAILinper:8}]},

{CourseName:"B.Pharma.", children:[

{Branch:"Pharmacy", Girls:70, Boys:130, TotalStudent:200, PASSinper:99.8, FAILinper:0.2}]},

{CourseName:"M.B.A.", children:[

{Branch:'HR', Girls:48, Boys:72, TotalStudent:120, PASSinper:100, FAILinper:0},

{Branch:'Finance', Girls:40, Boys:80, TotalStudent:120, PASSinper:85, FAILinper:15},

{Branch:'Marketing', Girls:20, Boys:100, TotalStudent:120, PASSinper:99, FAILinper:1},

{Branch:'IT & HR', Girls:30, Boys:90, TotalStudent:120, PASSinper:100, FAILinper:0}]},

{CourseName:"M.C.A.", children:[

{Branch:"Computer Science", Girls:30, Boys:90, TotalStudent: 120, PASSinper:99.1,

 FAILinper:0.9}]}

]}

]);

]]>

</fx:Script>

<s:Panel title="Style in AdvancedDataGrid Control Example" height="470" width="831">

<mx:AdvancedDataGrid

height="414"

x="13" y="13"

textRollOverColor="#FFFFFF"

textSelectedColor="#31197F"

useRollOver="true"

symbolColor="#61E4E2"

rollOverColor="#000000"

iconColor="#259992"

horizontalGridLines="true"

horizontalGridLineColor="#E9BFBF"

verticalGridLines="true"

verticalGridLineColor="#EAE867"

textAlign="left"

fontFamily="verdana"

color="#087181"

borderStyle="outset"

borderColor="#000000"

borderVisible="true"

chromeColor="#AFA7A7"

fontSize="12"

fontStyle="normal"

folderOpenIcon="@Embed

(source='C:/work/bikrant/flex4component/advanceddatagridstyle/DownArrow.gif')"

folderClosedIcon="@Embed

(source='C:/work/bikrant/flex4component/advanceddatagridstyle/RightArrow.gif')">

<mx:dataProvider>

<mx:HierarchicalData source="{student}"/>

</mx:dataProvider>

<mx:columns>

<mx:AdvancedDataGridColumn dataField="Course"/>

<mx:AdvancedDataGridColumn dataField="CourseName" headerText="CourseName"/>

<mx:AdvancedDataGridColumn dataField="Branch"/>

<mx:AdvancedDataGridColumn dataField="Girls"/>

<mx:AdvancedDataGridColumn dataField="Boys"/>

<mx:AdvancedDataGridColumn dataField="TotalStudent"/>

<mx:AdvancedDataGridColumn dataField="PASSinper"/>

<mx:AdvancedDataGridColumn dataField="FAILinper"/>

</mx:columns>

</mx:AdvancedDataGrid>

</s:Panel>

</s:Application>

Output:

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

Advertisements

Posted on: June 17, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.