Hi,
friends HELP HELP HELP
i am working on a code written below.
My problems is:-
1)I am not ablel to get the "no of rows"(i.e the no of childs) in
grouplabel field which is selected by initDG() function dynamically.I
like to print the no of child in front of group label.
Ex: if the grouplabel is india containig states as a child then i
would like to print no of child in front of them.
india(28)
Karnataka --- ---------- ---------
------------
Maharastra -- ---------- -----------
----------
--------- ---------- ----------
-----------
USA(55)
-------- ----------- ----------
--------
xyz(15)
------------ ------------- -----------
-----------
pqr(16)
.
.
2)How can i use the the genrated top level parents of grouping
collection as a data filed of first column,
So that the the india, USA,xyz,pqr comes under the first column.And i
can apply renderer over them-
3)Is it possible to attach a key or name with grouping filed for
using it as a datafield for a collum.
Action Script is:-
include "SimpleFlatData.as"
[Bindable]
public var myGColl:GroupingCollection = new
GroupingCollection();
private var myGrp:Grouping = new Grouping();
//The strHeaderName contains the name of groupingfiled
by which i
like to group the data
public function initDG(strHeaderName:String):void {
// Initialize the GroupingCollection instance.
myGColl.source = dpFlat;// dpFlat is a Name of my flat
data ArrayCollection
// The Grouping instance defines the grouping fields
// in the collection, and the order of the groups
// in the hierarchy.
myGrp.fields =
[new GroupingField(strHeaderName)];
// The grouping property contains a Grouping instance.
myGColl.grouping = myGrp;
// Specify the GroupedCollection as the data provider for
// the AdvancedDataGrid control.
myADG.dataProvider=myGColl; //myADG is the id of
my Advanced Data Grid
// Refresh the display.
myGColl.refresh();
}
//function to print no of child in front grouped item but it is not
working for grouped data.
public function
groupLabelFunction(item:Object,column:AdvancedDataGridColumn):String{
if (item && item.children)
{
return item[column.dataField] + " (" + item.children.length +
")";
}
else
{
return item[column.dataField];
}
}
//Function to expand and collapse the rows when user click on a
corresponding grouping filed values.
private function advanced_itemClick(evt:ListEvent):void
{
var item:Object=AdvancedDataGrid(evt.currentTarget).selectedItem;
myADG.expandItem(item,!myADG.isItemOpen(item),true);
}
mxml part is :-
<mx:AdvancedDataGrid creationComplete="initDG('Capital');"
dragEnabled="true" dropEnabled="true" verticalScrollPolicy="auto"
horizontalScrollPolicy="auto" sortExpertMode="false"
sortableColumns="true" disclosureClosedIcon="{null}"
disclosureOpenIcon="{null}" id="myADG" width="100%" height="100%"
itemClick="advanced_itemClick(event);"
folderClosedIcon="{null}" folderOpenIcon="{null}"
defaultLeafIcon="{null}" allowMultipleSelection="true"
selectionColor="0xBDEDFF">
<mx:groupedColumns>
<mx:AdvancedDataGridColumnGroup headerText="G">
<mx:headerRenderer>
<mx:Component>
<mx:HBox name="GroupCol">
</mx:HBox>
</mx:Component>
</mx:headerRenderer> //what i have to write in place of
dataField="GroupLabel" so that the grouping field becomes a member of
that column and i could apply any rendrer on the grouping
filed(grouping is selected in run time using intDG function).
<mx:AdvancedDataGridColumn labelFunction="groupLabelFunction"
dataField="GroupLabel" id="col0" headerText="Group"
backgroundColor="0x000000" styleFunction="myStyleFunction"
color="0xFFFF00" />
</mx:AdvancedDataGridColumnGroup>
<mx:AdvancedDataGridColumnGroup headerText="Dist">
<mx:headerRenderer>
<mx:Component>
<mx:HBox name="Dist" click="outerDocument.initDG(name)">
</mx:HBox>
</mx:Component>
</mx:headerRenderer>
<mx:AdvancedDataGridColumn id="col1" color="0xFFFF00"
backgroundColor="0x000000" headerText="Dist" dataField="Genre"/>
</mx:AdvancedDataGridColumnGroup>
</mx:groupedColumns>
.
.
.
.
.
other columns
</mx:AdvancedDataGrid>
Thank You in Advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---