hey all......
I am new to flex.
i m working on a flex project in which i am using
advanced data grid control and trying to customize its properties.
In my project i have created grouping at runtime.For this i have made
a function and it is working fine.
Now i need to print no of children in the label of groupinglabel like
this
FolkSongs(8)
Sad(4) etc
could you help me for this..........One more thing i am using flat
data for my application so there is no tag like children by which i
can access children. I am telling you this because i was using
hierarchical data for my application before and by using children
tag , i was able to print its children through itemrenderer.but now i
have changed heirarchical data with the flat data.
For this i wrote a function. I think some changes to this function
will work for me .
function for creating run time grouping
public var myGColl:GroupingCollection = new GroupingCollection();
private var myGrp:Grouping = new Grouping();
public function initDG(strHeaderName:String):void {
myGColl.source = dpFlat;
myGrp.fields = [new GroupingField(strHeaderName)];
myADG.dataProvider=myGColl;
myGColl.refresh();
}
Function for printing no of children when i was using hierarchical
data, I used this function as a labelfunction it is returning label
text to item renderer.
public function
groupLabelFunction(item:Object,column:AdvancedDataGridColumn):String{
if (item && item.children)
{
;
return item[column.dataField] + " (" + item.children.length + ")";
}
else
{
return item[column.dataField];
}
}
flatdata file
private var dpFlat:ArrayCollection = new ArrayCollection([
{Title:"Megam Kottatum",Artists:"Ilayraja",Album:"Ennakul
Oruvan",Length:"00:05:35",Genre:"Fast",Rating:"(5)
Star",Year:"1984",Album_artist:"Ilayaraja",Bit_rate:"128kbps",Copyright:""},
{Title:"Aasai Nooru Vagai",Artists:"Ilayraja", Album:"Folk Songs",
Length:"00:04:32", Genre:"Fast",Rating:"(2.5)
Star",Year:"",Album_artist:"Ilayaraja",Bit_rate:"128kbps",Copyright:""},
{Title:"Madai
Thiranthu",Artists:"Ilayraja",Album:"Nizhalgal",Length:"00:04:21",Genre:"Fast",Rating:"(2)
Star",Year:"",Album_artist:"Ilayaraja",Bit_rate:"96kbps",Copyright:""},
{Title:"Maarugo",Artists:"Ilayraja",Album:"Vetri
Vizha",Length:"00:05:49",Genre:"Fast",Rating:"(3.5)
Star" ,Year:"",Album_artist:"Ilayaraja",Bit_rate:"128kbps",Copyright:""},
{Title:"Joe Smith",Artists:"rajat
batra",Album:"xyz",Length:"00:05:15", Genre:"Blues", Rating:"(4)
Star",Year:"",Album_artist:"Joe
Smith",Bit_rate:"96kbps",Copyright:""},
{Title:"Bethany Pittman",Artists:"rupesh suyal",
Album:"abc",Length:"00:06:20",Genre:"Devotional",Rating:"(0)
Star",Year:"",Album_artist:"Bethany
Pittman",Bit_rate:"128kbps",Copyright:""},
{Title:"Pandiyanin Rajiya",Artists:"rupesh
suyal",Album:"def",Length:"00:05:46",Genre:"Happy",Rating:"(3)
Star",Year:"1993",Album_artist:"",Bit_rate:"96kbps",Copyright:""},
{Title:"Singlathu",Artists:"rajat batra",Album:"Punnagai
Mannan",Length:"00:04:17",Genre:"Happy",Rating:"(1.5)
Star",Year:"",Album_artist:"",Bit_rate:"128kbps",Copyright:""},
{Title:"Vaa Vaa Anbe",Artists:"Ilayraja",Album:"Agni
Natchathiram",Length:"00:04:42",Genre:"Melody", Rating:"(1.5)
Star",Year:"",Album_artist:"Ilayaraja",Bit_rate:"128kbps",Copyright:""},
{Title:"Ninnukori Varanam",Artists:"Ilayraja",Album:"Agni
Natchathiram",Length:"00:04:36",Genre:"Melody", Rating:"(4.5)
Star",Year:"",Album_artist:"Ilayaraja",Bit_rate:"128kbps",Copyright:""}
]);
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---