Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
mark416 #1
Question for AdvancedDataGrid?
Hi,
I did a AdvancedDataGrid without grouping,it works fine.
<mx:AdvancedDataGri d x="8" y="72" width="558" height="247"
rowCount="4" dataProvider= "{modelLocator. QModel}" >
<mx:columns>
<mx:AdvancedDataGri dColumn headerText=" Name" dataField="Name" />
<mx:AdvancedDataGri dColumn headerText=" Current Status"
dataField="TypeName "/>
</mx:columns>
</mx:AdvancedDataGr id>
But it shows nothing with group feature. I check the syntax but it
seems ok. do you know why this happen. Thanks
<mx:AdvancedDataGri d x="8" y="72" width="558" height="247"
rowCount="4" >
<mx:dataProvider>
<mx:GroupingCollect ion id="gc1" source="{modelLocat or.QModel} ">
<mx:Grouping>
<mx:GroupingField name="TypeName" />
</mx:Grouping>
</mx:GroupingCollec tion>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGri dColumn headerText=" Name" dataField="Name" />
<mx:AdvancedDataGri dColumn headerText=" Current Status"
dataField="TypeName "/>
</mx:columns>
</mx:AdvancedDataGr id>
Thanks in advance
Mark
mark416 Guest
-
Stuck in the AdvancedDatagrid
Hi All, I want to access the data within the Advanced Datagrid but I cant seem to do it. I have defined some summary data using Grouping... -
AdvancedDataGrid and HierarchicalData
I'm having a problem with the AdvancedDataGrid and HierachicalData. I have an HTTPService that is getting data from an XML file off the server. I... -
AdvancedDataGrid Sorting
I'm having a problem getting an AdvancedDataGrid to sort data in the proper order. I'm using a GroupingCollection as the dataprovider and I have... -
AdvancedDataGrid styling help
Hello, I am trying to style an ADG such that certain horizontal lines in the grid are rendered with larger line thicknesses. I have tried a... -
Could not resolve <mx:AdvancedDataGrid>
hi, all, I don't have much experience on Flex, and I met this problem when I try to open my mxml on Tomcat: Could not resolve... -
mark416 #2
Question for AdvancedDataGrid?
Hi,
I have the following question about AdvancedDataGrid?
The code works fine:(code 1)
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundColor="#32669D"
xmlns:ext="nl.wv.extenders.panel.*"
width="854">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var dpFlat:ArrayCollection = new ArrayCollection([
{Region:"Southwest", Territory:"Arizona",
Territory_Rep:"Barbara Jennings", Actual:38865,
Estimate:40000},
{Region:"Southwest", Territory:"Arizona",
Territory_Rep:"Dana Binn", Actual:29885,
Estimate:30000},
{Region:"Southwest", Territory:"Central California",
Territory_Rep:"Joe Smith", Actual:29134,
Estimate:30000},
{Region:"Southwest", Territory:"Nevada",
Territory_Rep:"Bethany Pittman", Actual:52888,
Estimate:45000},
{Region:"Southwest", Territory:"Northern California",
Territory_Rep:"Lauren Ipsum", Actual:38805,
Estimate:40000},
{Region:"Southwest", Territory:"Northern California",
Territory_Rep:"T.R. Smith", Actual:55498,
Estimate:40000},
{Region:"Southwest", Territory:"Southern California",
Territory_Rep:"Alice Treu", Actual:44985,
Estimate:45000},
{Region:"Southwest", Territory:"Southern California",
Territory_Rep:"Jane Grove", Actual:44913,
Estimate:45000}
]);
]]>
</mx:Script>
<mx:Panel id="panel04" title="test panel"
x="255" y="100" width="575" height="342"
layout="absolute" >
<mx:Label x="15"
y="46" text=" Requests in the queue:"
width="152" f/>
<mx:AdvancedDataGrid id="myADG" x="36" y="72"
initialize="gc.refresh();" width="520" height="218">
<mx:dataProvider>
<mx:GroupingCollection id="gc" source="{dpFlat}">
<mx:grouping>
<mx:Grouping>
<mx:GroupingField name="Territory"/>
</mx:Grouping>
</mx:grouping>
</mx:GroupingCollection>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="Region"/>
<mx:AdvancedDataGridColumn dataField="Territory"/>
<mx:AdvancedDataGridColumn dataField="Territory_Rep"
headerText="Territory Rep"/>
</mx:columns>
</mx:AdvancedDataGrid>
</mx:Panel>
</mx:Application>
--------------------------------------------------------------------------------
------------------------------------------------------
This code doesn't work (code 2)
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundColor="#32669D"
xmlns:ext="nl.wv.extenders.panel.*"
creati show="QueueRequest()" width="854">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var dpFlat:ArrayCollection ;
private function QueueRequest():void{
var dpFlat:ArrayCollection = new ArrayCollection([
{Region:"Southwest", Territory:"Arizona",
Territory_Rep:"Barbara Jennings", Actual:38865,
Estimate:40000},
{Region:"Southwest", Territory:"Arizona",
Territory_Rep:"Dana Binn", Actual:29885,
Estimate:30000},
{Region:"Southwest", Territory:"Central California",
Territory_Rep:"Joe Smith", Actual:29134,
Estimate:30000},
{Region:"Southwest", Territory:"Nevada",
Territory_Rep:"Bethany Pittman", Actual:52888,
Estimate:45000},
{Region:"Southwest", Territory:"Northern California",
Territory_Rep:"Lauren Ipsum", Actual:38805,
Estimate:40000},
{Region:"Southwest", Territory:"Northern California",
Territory_Rep:"T.R. Smith", Actual:55498,
Estimate:40000},
{Region:"Southwest", Territory:"Southern California",
Territory_Rep:"Alice Treu", Actual:44985,
Estimate:45000},
{Region:"Southwest", Territory:"Southern California",
Territory_Rep:"Jane Grove", Actual:44913,
Estimate:45000}
]);
}
]]>
</mx:Script>
<mx:Panel id="panel04" title="test panel"
x="255" y="100" width="575" height="342"
layout="absolute" >
<mx:Label x="15"
y="46" text=" Requests in the queue:"
width="152" f/>
<mx:AdvancedDataGrid id="myADG" x="36" y="72"
initialize="gc.refresh();" width="520" height="218">
<mx:dataProvider>
<mx:GroupingCollection id="gc" source="{dpFlat}">
<mx:grouping>
<mx:Grouping>
<mx:GroupingField name="Territory"/>
</mx:Grouping>
</mx:grouping>
</mx:GroupingCollection>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="Region"/>
<mx:AdvancedDataGridColumn dataField="Territory"/>
<mx:AdvancedDataGridColumn dataField="Territory_Rep"
headerText="Territory Rep"/>
</mx:columns>
</mx:AdvancedDataGrid>
</mx:Panel>
</mx:Application>
--------------------------------------------------------------------------------
-----------------------------------
The different between code 1 and code 2 is :
I assign ArrayCollection in a function in code 2, but I need to do the
code like this way.
Why code 2 show nothing in the AdvancedDataGrid now?
Do you know how to make code 2 work.
Thanks for your help.
Mark
mark416 Guest
-
Sreenivas R #3
Re: AdvancedDataGrid doesn't update?
I am unable to guess what you mean by reopening the page.
GroupingCollection has logic in place to listen to source collection changes
and act accordingly. But if ModelLocator.QModel is an Array or something else
which won't fire change events GC has no way of knowing the source has changed.
Sreenivas R Guest
-
Linh ??p trai #4
Re: AdvancedDataGrid doesn't update?
make sure ModelLocator.QModel has changed ???
Linh ??p trai Guest
-
laurent pinson #5
Re: AdvancedDataGrid doesn't update?
you need to use <your AdvancedDatagrid>.validateNow() just after :p
laurent pinson Guest
-
mark416 #6
Re: AdvancedDataGrid doesn't update?
'reopening the page' means access the same page after the data are changed.
I am sure the ModelLocator.QModel already are changed the is the
arraycollection.
"<your AdvancedDatagrid>.validateNow() just after :p ",I do not understand
what this means,Please help me.
mark416 Guest
-
laurent pinson #7
Re: AdvancedDataGrid doesn't update?
well, i think you just need to call the validateNow method of AdvancedDataGrid class after updating your dataprovider.
That's how it works for me
laurent pinson Guest
-
mark416 #8
Re: AdvancedDataGrid doesn't update?
how to call validateNow method of AdvancedDataGrid?
gc.validateNow
do you think if it is the right syntax?Thanks
mark416 Guest
-
laurent pinson #9
Re: AdvancedDataGrid doesn't update?
gc.validateNow()
Mhmm in mxml, i don't see how you could do that. Maybe if you can listen to
some "dataprovider update" event, you could then activate this method.
In actionScript, it's easier :p
laurent pinson Guest
-
laurent pinson #10
Re: AdvancedDataGrid doesn't update?
I am "reopening" with topic because in fact i have the same problem =_=.
Mhmm i display an advancedDataGrid with several buttons in the header :
- add element
- delete element(s)
- refresh
Well basically, "refresh" is just giving to my advancedDataGrid.provider a new
instance of HierarchicalData (that i populated with an ArrayCollection). I can
refresh or select different HierarchicalData, it will always display the good
values. It works perfectly and i don't need to use "validateNow".
[Q]
private function updateDisplay(arr:Array):void{
var hd:HierarchicalData = new HierarchicalData();
hd.source = new ArrayCollection(arr);
dataGrid.dataProvider=hd;
}
[/Q]
"Add element" and "delete element" work perfectly if i add or delete an
element in the root... but if it's in some nodes, advanceDataGrid doesn't
update whereas the dataprovider is updated (when i look with debug tools).
Adding element is not a problem as i will always add them at the end of the
tree in the root and use the drag & drop to arrange them in my tree. But i need
to delete items at different depth
What do i miss ? :(
laurent pinson Guest



Reply With Quote

