Question for AdvancedDataGrid?

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default Re: AdvancedDataGrid doesn't update?

    make sure ModelLocator.QModel has changed ???

    Linh ??p trai Guest

  6. #5

    Default Re: AdvancedDataGrid doesn't update?

    you need to use <your AdvancedDatagrid>.validateNow() just after :p
    laurent pinson Guest

  7. #6

    Default 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

  8. #7

    Default 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

  9. #8

    Default 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

  10. #9

    Default 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

  11. #10

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139