YossiBa
asked on
Seperate Parent Field & Hirarchy Field in AdvancedDataGrid - please help
Hi,
I am creating a TreeGrid using the AdvancedDataGrid in Flex 3.
The function that build my group columns is :
private function setGroupedColumns():void
{
var groupingCollection:Groupin gCollectio n=new GroupingCollection()
var grouping:Grouping=new Grouping()
var groupingField:GroupingFiel d
grouping.fields=new Array()
// Set the parents columns
var parentIds:ArrayCollection = properties.parantIdColumns as
ArrayCollection;
// Setting the Parent field
groupingField=new GroupingField("parent");
grouping.fields.push(group ingField)
groupingCollection.source= ArrayColle ction(remo teDP)
groupingCollection.groupin g=grouping
groupingCollection.refresh ()
myADG.dataProvider=groupin gCollectio n
}
Here I get a Tree and "parent" field as its parent.
If I push more fields to
grouping.fields.push(group ingField)
I get more sub childrens.
Thats not what I need.
How can I set parent field to stay the parent (in the background) but
to set different field(column) to be the hirarchy column (with the
folder icon or arrow).
The parent column should look as a normal column but the hirarchy
will be based on its data. the Tree appearance will be shown in a
different field.
Can I do it?
Thanks
Jo
I am creating a TreeGrid using the AdvancedDataGrid in Flex 3.
The function that build my group columns is :
private function setGroupedColumns():void
{
var groupingCollection:Groupin
var grouping:Grouping=new Grouping()
var groupingField:GroupingFiel
grouping.fields=new Array()
// Set the parents columns
var parentIds:ArrayCollection = properties.parantIdColumns
ArrayCollection;
// Setting the Parent field
groupingField=new GroupingField("parent");
grouping.fields.push(group
groupingCollection.source=
groupingCollection.groupin
groupingCollection.refresh
myADG.dataProvider=groupin
}
Here I get a Tree and "parent" field as its parent.
If I push more fields to
grouping.fields.push(group
I get more sub childrens.
Thats not what I need.
How can I set parent field to stay the parent (in the background) but
to set different field(column) to be the hirarchy column (with the
folder icon or arrow).
The parent column should look as a normal column but the hirarchy
will be based on its data. the Tree appearance will be shown in a
different field.
Can I do it?
Thanks
Jo
ASKER
well, no,
It creates a parent column (Region) and its sub parent (Territory).
What I need is to make Region as the logic parent but the only parent column visible is Territory.
Region should look as a child
It creates a parent column (Region) and its sub parent (Territory).
What I need is to make Region as the logic parent but the only parent column visible is Territory.
Region should look as a child
>> What I need is to make Region as the logic parent
>> Region should look as a child
So you want Region to be the logic parent of Territory, while you want to see it as a child of Territory?
Why do you want to see the parent-child relation otherwise then it really is?
>> Region should look as a child
So you want Region to be the logic parent of Territory, while you want to see it as a child of Territory?
Why do you want to see the parent-child relation otherwise then it really is?
Do you mean this?
I really don't get it, I think.
Could you draw it somehow?
I really don't get it, I think.
Could you draw it somehow?
<mx:AdvancedDataGrid id="myADG"
width="100%" height="100%"
initialize="gc.refresh();">
<mx:dataProvider>
<mx:GroupingCollection id="gc" source="{dpFlat}">
<mx:grouping>
<mx:Grouping>
<mx:GroupingField name="Territory"/>
<mx:GroupingField name="Region"/>
</mx:Grouping>
</mx:grouping>
</mx:GroupingCollection>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="Territory"/>
<mx:AdvancedDataGridColumn dataField="Region"/>
</mx:columns>
</mx:AdvancedDataGrid>
ASKER
Yes, it sounds stupid but we have already an old application using html and there this attributes:
HirarchyColumnId (Teritory in our case)
ParentId(Region),
The user can switch between Hirarchy ids, but the parent will always remain the logic parent.
This is actualy done in TreeGrid if we drag a column to be the first field, it becomes the hirarch column,
can we do that in code?
Thanks for your help
HirarchyColumnId (Teritory in our case)
ParentId(Region),
The user can switch between Hirarchy ids, but the parent will always remain the logic parent.
This is actualy done in TreeGrid if we drag a column to be the first field, it becomes the hirarch column,
can we do that in code?
Thanks for your help
ASKER
Well I have come a cross a very crucial issue I have problem with,
frankly its more importent and of course I will raise my granted points :))) if you can help me here.
I am using ItemRenderer for my grid and RemoteObject to retrieve the data to the grid.
When first loaded I create a new RemoteObject and display the grid.
How can I do a lazy loading using the ItemRenderer to retrieve the relevant data from the server of the parent and childs?
should I create a new RemoteObject? but where do I place it in the renderer?
This is very importent to me, if you can help me here,
Please
Thanks man
Jo
frankly its more importent and of course I will raise my granted points :))) if you can help me here.
I am using ItemRenderer for my grid and RemoteObject to retrieve the data to the grid.
When first loaded I create a new RemoteObject and display the grid.
How can I do a lazy loading using the ItemRenderer to retrieve the relevant data from the server of the parent and childs?
should I create a new RemoteObject? but where do I place it in the renderer?
This is very importent to me, if you can help me here,
Please
Thanks man
Jo
ASKER
This is the max point I've got :(
>> This is the max point I've got :(
That's no problem.
>> How can I do a lazy loading using the ItemRenderer to retrieve the relevant data from the server of the parent and childs?
Lazy loading is a matter of going (once) to the server only when needed.
some kind of:
private var _data:YourData = null;
private function get dataToVisualize():YourData {
if (_data==null) {
_data = .... // get it by going to the server
}
return _data;
}
That's no problem.
>> How can I do a lazy loading using the ItemRenderer to retrieve the relevant data from the server of the parent and childs?
Lazy loading is a matter of going (once) to the server only when needed.
some kind of:
private var _data:YourData = null;
private function get dataToVisualize():YourData
if (_data==null) {
_data = .... // get it by going to the server
}
return _data;
}
ASKER
thanks for the help,
Should this routine be in the ItemRenderer? where?
for retrieving the exact data when I open a parent node (to show all its childrens) I need to know what node was clicked, where do I get it from?
The follwing function(in my ItemIRenderer) is executed when I click on a parent node:
public function set listData(value:BaseListDat a):void
{
_listData = DataGridListData(value);
}
I think I need to replace the value by going to the server, I can do that by creating a new RemoteObject and get the relevant data by sending the parent id,
How do I get this parentId?
I have lots of Q's :((
Please advise if you can
Thanks man :)
Should this routine be in the ItemRenderer? where?
for retrieving the exact data when I open a parent node (to show all its childrens) I need to know what node was clicked, where do I get it from?
The follwing function(in my ItemIRenderer) is executed when I click on a parent node:
public function set listData(value:BaseListDat
{
_listData = DataGridListData(value);
}
I think I need to replace the value by going to the server, I can do that by creating a new RemoteObject and get the relevant data by sending the parent id,
How do I get this parentId?
I have lots of Q's :((
Please advise if you can
Thanks man :)
>> I need to know what node was clicked, where do I get it from?
out of the datagrid
public function set listData(value:BaseListDat a):void {
_listData = DataGridListData(value);
var dg:DataGrid = DataGrid(_listData.owner);
// now you can get the selected row and out of that you can probably het the parent id
}
out of the datagrid
public function set listData(value:BaseListDat
_listData = DataGridListData(value);
var dg:DataGrid = DataGrid(_listData.owner);
// now you can get the selected row and out of that you can probably het the parent id
}
ASKER
Ok,
SO if I understand you it should look something like that:
public function set listData(value:BaseListDat a):void {
_listData = DataGridListData(value);
var dg:DataGrid = DataGrid(_listData.owner);
var dataService:RemoteObject;
dataService = new RemoteObject("MyHandler2") ;
....
....
// retrieving the new data from the server
dg.dataProvider = myNewLimitedDataProvider
var openNodes:Object = IHierarchicalCollectionVie w(adg.data Provider). openNodes;
adg.validateNow();
IHierarchicalCollectionVie w(adg.data Provider). openNodes = openNodes;
}
Never tried that....
is that sims correct?
should it all be in this function?
should i update _listData again?
Thanks man
SO if I understand you it should look something like that:
public function set listData(value:BaseListDat
_listData = DataGridListData(value);
var dg:DataGrid = DataGrid(_listData.owner);
var dataService:RemoteObject;
dataService = new RemoteObject("MyHandler2")
....
....
// retrieving the new data from the server
dg.dataProvider = myNewLimitedDataProvider
var openNodes:Object = IHierarchicalCollectionVie
adg.validateNow();
IHierarchicalCollectionVie
}
Never tried that....
is that sims correct?
should it all be in this function?
should i update _listData again?
Thanks man
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I will try that,
my last question realy :))
As you've seen, I created the RemoteObject, now I need to activate it manualy
what should I do to fire the remoteObject to get my data back?
Thanks a lot man, you realy helped me
my last question realy :))
As you've seen, I created the RemoteObject, now I need to activate it manualy
what should I do to fire the remoteObject to get my data back?
Thanks a lot man, you realy helped me
>> what should I do to fire the remoteObject to get my data back?
Sorry, I don't know.
You'll have to search for documentation on how to work with RemoteObjects
Sorry, I don't know.
You'll have to search for documentation on how to work with RemoteObjects
Thanx 4 axxepting
I think it does what you want. Right?
Open in new window