2 Replies Latest reply on Aug 19, 2009 2:37 PM by GeorgeWS

    Advanceddatagrid problem

    GeorgeWS Level 1

      I have an app that has 2 unrelated ADG's they both get data from RO's/ArrayCollection's. The first ADG has grouping and Summing and works perfectly. The second ADG fills with data and when I press on a header to sort it all the data dissapears. This grid has no grouping so I could try and debug easier but cannot seem to find the problem 2 days I have been trying different stuff. Any Thoughts

       

      George

        • 1. Re: Advanceddatagrid problem
          Gregory Lafrance Level 6

          For this we'll need to see simplified yet complete code and data sample.

          • 2. Re: Advanceddatagrid problem
            GeorgeWS Level 1

            This is my application:

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

            <?xml version="1.0" encoding="utf-8"?>

            <mx:Application

             

             

            xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initVars()" layout="absolute"

            >

             

             

             

            <mx:Script>

            <![CDATA[

             

             

            import

            mx.rpc.events.ResultEvent;

             

             

            import

            mx.controls.Alert;

             

             

            import

            mx.collections.ArrayCollection;

             

             

            import

            mx.core.Application;

             

             

            import

            mx.utils.ObjectUtil;

             

             

            import

            mx.core.IUIComponent;

             

             

            import

            mx.events.SliderEvent;

             

             

            import

            mx.controls.sliderClasses.Slider;

             

             

            [

             

            Bindable] public var

            myRac:ArrayCollection;

            [

             

            Bindable] public var

            myDep:ArrayCollection;

            [

             

            Bindable] public var

            myDates:ArrayCollection;

            [

             

            Bindable] public var

            SupplierID:String;

            [

             

            Bindable] public var

            BrandID:String;

            [

             

            Bindable] public var

            SupComp:String;

            [

             

            Bindable] public var

            myRegion:String;

            [

             

            Bindable] public var

            mySummary:Boolean;

            [

             

            Bindable] public var

            thumbTwoA:String;

            [

             

            Bindable] public var

            thumbTwoB:String;

            [

             

            Bindable] public var aReturnTypes: Array = [ {label:"query", data:"query"

            } ];

            [

             

            Bindable] public var returnType:String="string"

            ;

             

             

             

            public function handleQueryResult(event:ResultEvent):void

            {

            myRac=event.result

             

            as

            ArrayCollection;

            myRac.filterFunction = sliderFilterFunc;

            gc.refresh();

            }

             

             

             

            public function handleQueryResult5(event:ResultEvent):void

            {

            myDep=event.result

             

            as

            ArrayCollection;

            myDep.filterFunction = sliderFilterFunc;

             

            }

             

            [

             

            Bindable] public var

            selectedItem:Object;

             

             

             

            public function initVars() : void

            {

            SupplierID = Application.application.parameters.SupplierID;

            BrandID = Application.application.parameters.BrandID;

            SupComp = Application.application.parameters.SupComp;

            qRac.Rac(SupplierID, BrandID, SupComp);

            qDep.Dep(SupplierID, BrandID, SupComp);

            Brands.Brands.send();

            Dates.Dates.send();

            }

             

            [

             

            Bindable] private var newBrands:ArrayCollection=new

            ArrayCollection;

             

             

             

            public function

            doPrompt( event:ResultEvent

            ):

             

            void

            {

            newBrands = Brands.Brands.lastResult;

             

             

            var prompt:Object = new

            Object();

             

            prompt.data =

             

            null

            ;

            prompt.label =

             

            "Select Brand"

            ;

             

            newBrands.addItemAt( prompt, 0 );

            brandfilter.selectedIndex = 0;

            }

             

             

             

             

            public function slider_change(evt:SliderEvent):void

            {

            gc.refresh();

            myDep.refresh();

            }

             

             

             

            public function

            sliderFilterFunc(item:Object):Boolean {

             

             

            var

            minSlider:uint = slider.values[0];

             

             

            var

            maxSlider:uint = slider.values[1];

             

             

            if

            ((item.value >= minSlider) &&

            (item.value <= maxSlider)) {

             

             

            return true

            ;

            }

             

            else

            {

             

             

            return false

            ;

            }

            }

             

             

             

             

             

            public function doPrompt3( event:ResultEvent ):void

            {

            myDates = Dates.Dates.lastResult;

            }

             

             

             

            private function

            getSliderLabel(value:String):String

            {

             

             

            return

            myDates[parseInt(value)].myDates;

            }

             

            ]]>

             

             

            </mx:Script>

             

             

             

            <mx:RemoteObject

            id="

             

            qRac

            "

            destination="

             

            ColdFusion

            "

            source="

             

            youngsmarket.programs.racdepletion.racdepletion.bin-debug.racdepletion

            "

            showBusyCursor="

             

            true" >

             

             

            <mx:method name="Rac

            " result="handleQueryResult(event)"

            fault="Alert.show(event.fault.message)"

             

            >

             

             

            <mx:arguments>

             

             

            <supplierid>{SupplierID}

            </supplierid>

             

             

            <brandid>{BrandID}

            </brandid>

             

             

            <supcomp>{SupComp}

            </supcomp>

             

             

            </mx:arguments>

             

             

            </mx:method>

             

             

            </mx:RemoteObject>

             

             

             

            <mx:RemoteObject

            id="

             

            qDep

            "

            destination="

             

            ColdFusion

            "

            source="

             

            youngsmarket.programs.racdepletion.racdepletion.bin-debug.racdepletion

            "

            showBusyCursor="

             

            true" >

             

             

            <mx:method name="Dep

            " result="handleQueryResult5(event)"

            fault="Alert.show(event.fault.message)"

             

            >

             

             

            <mx:arguments>

             

             

            <supplierid>{SupplierID}

            </supplierid>

             

             

            <brandid>{BrandID}

            </brandid>

             

             

            <supcomp>{SupComp}

            </supcomp>

             

             

            </mx:arguments>

             

             

            </mx:method>

             

             

            </mx:RemoteObject>

             

             

             

            <mx:RemoteObject

            id="

             

            Brands

            "

            destination="

             

            ColdFusion

            "

            source="

             

            youngsmarket.programs.racdepletion.racdepletion.bin-debug.racdepletion

            "

            showBusyCursor="

             

            true" >

             

             

            <mx:method name="Brands" result="doPrompt( event )"

            >

             

             

            <mx:arguments>

             

             

            <supplierid>{SupplierID}

            </supplierid>

             

             

            <brandid>{BrandID}

            </brandid>

             

             

            <supcomp>{SupComp}

            </supcomp>

             

             

            </mx:arguments>

             

             

            </mx:method>

             

             

            </mx:RemoteObject>

             

             

              

             

             

             

            <mx:RemoteObject

            id="

             

            Dates

            "

            destination="

             

            ColdFusion

            "

            source="

             

            youngsmarket.programs.racdepletion.racdepletion.bin-debug.racdepletion

            "

            showBusyCursor="

             

            true" >

             

             

            <mx:method name="Dates" result="doPrompt3( event )"

            />

             

             

            </mx:RemoteObject>

             

             

             

            <mx:Panel title="RAC/Depletion" height="100%" width="100%

            "

            paddingTop="

             

            5" paddingLeft="5" paddingRight="5" paddingBottom="5" cornerRadius="10" roundedBottomCorners="true" top="0" bottom="0" left="0" right="0" borderColor="#7A909B" backgroundColor="#96A7AF"

            >

             

              

            <mx:HBox

             

             

            width="100%"

            >

             

             

            <mx:ComboBox id="brandfilter" dataProvider="{newBrands}

            "

            labelField="

             

            label" width="120

            "

            close="selectedItem=ComboBox(event.target).selectedItem"

            change="gc.refresh();myDep.refresh()" themeColor="

             

            #73B9B9"

            />

             

             

             

            <mx:HSlider id="slider

            "

            minimum="

             

            1

            "

            maximum="

             

            12

            "

            values="

             

            [1,12]

            "

            labels="

             

            [Jan,Dec]

            "

            thumbCount="

             

            2

            "

            showTrackHighlight="

             

            true

            "

            snapInterval="

             

            1

            "

            tickInterval="

             

            1

            "

            liveDragging="

             

            true

            "

            change="slider_change(event);"

            dataTipFormatFunction="

             

            getSliderLabel" themeColor="#73B9B9"

            />

             

             

            <mx:RadioButtonGroup id="myReport"/>

             

             

            <mx:RadioButton groupName="myReport" label="RAC

            "

            click="accordion.selectedIndex=0;" selected="

             

            true" width="50" themeColor="#73B9B9"

            />

             

             

            <mx:RadioButton groupName="myReport" label="Dep

            "

            click="accordion.selectedIndex=1;" width="

             

            50" themeColor="#73B9B9"

            />

             

             

            <mx:Spacer width="100%"

            />

             

             

            <mx:CheckBox id="mySum" label="Sum Region" selected="true

            "

            width="

             

            96" themeColor="#73B9B9"

            />

             

             

            </mx:HBox>

            <mx:Accordion

             

             

            id="accordion" width="100%" height="100%

            "

            headerHeight="

             

            5" themeColor="#73B9B9"

            >

            <mx:VBox

             

             

            width="100%" height="100%" >

             

             

            <mx:AdvancedDataGrid id="myDataGrid" width="100%

            "

            height="

             

            100%" themeColor="#73B9B9"

            >

             

            <mx:dataProvider>

             

             

            <mx:GroupingCollection id="gc" source="{myRac}"

            >

             

             

            <mx:Grouping>

             

             

            <mx:GroupingField name="myHeader"

            >

             

             

             

            <mx:SummaryRow summaryPlacement="group"

            >

             

             

            <mx:fields>

             

             

            <mx:SummaryField dataField="PCTONU" operation="SUM" label="PCTONU"

            />

             

             

            <mx:SummaryField dataField="PCCHNU" operation="SUM" label="PCCHNU"

            />

             

             

            <mx:SummaryField dataField="PCNFNU" operation="SUM" label="PCNFNU"

            />

             

             

            <mx:SummaryField dataField="PCCONU" operation="SUM" label="PCCONU"

            />

             

             

            <mx:SummaryField dataField="PCMINU" operation="SUM" label="PCMINU"

            />

             

             

            <mx:SummaryField dataField="PCONNU" operation="SUM" label="PCONNU"

            />

             

             

            <mx:SummaryField dataField="PCNONU" operation="SUM" label="PCNONU"

            />

             

             

            <mx:SummaryField dataField="PCTRNU" operation="SUM" label="PCTRNU"

            />

             

             

            <mx:SummaryField dataField="PCINNU" operation="SUM" label="PCINNU"

            />

             

             

            <mx:SummaryField dataField="PCWHNU" operation="SUM" label="PCWHNU"

            />

             

             

            </mx:fields>

             

             

            </mx:SummaryRow>

             

             

             

            </mx:GroupingField>

             

             

            </mx:Grouping>

             

             

            </mx:GroupingCollection>

             

             

            </mx:dataProvider>

             

             

             

            <mx:groupedColumns>

             

            <mx:AdvancedDataGridColumn

             

             

            dataField="myHeader" headerText="Product

            "

            minWidth="

             

            75"

            />

             

            <mx:AdvancedDataGridColumn

             

             

            dataField="value" headerText="Month

            "

            minWidth="

             

            20"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="SDIVDE" headerText="Size

            "

            minWidth="

             

            50"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="ISCF5W" headerText="Pac" minWidth="20"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="PCTONU" headerText="Sales

            "

            textAlign="

             

            right" minWidth="26" itemRenderer="NumberItemRenderer"

            />

             

            <mx:AdvancedDataGridColumn

             

             

            dataField="PCCHNU" headerText="Chain

            "

            textAlign="

             

            right" minWidth="50" itemRenderer="NumberItemRenderer2"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="PCNFNU" headerText="Nat Off Prem

            "

            textAlign="

             

            right" minWidth="50" itemRenderer="NumberItemRenderer3"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="PCCONU" headerText="Convin

            "

            textAlign="

             

            right" minWidth="50" itemRenderer="NumberItemRenderer4"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="PCMINU" headerText="Military

            "

            textAlign="

             

            right" minWidth="50" itemRenderer="NumberItemRenderer5"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="PCONNU" headerText="On Prem

            "

            textAlign="

             

            right" minWidth="50" itemRenderer="NumberItemRenderer6"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="PCNONU" headerText="Nat On Prem

            "

            textAlign="

             

            right" minWidth="50" itemRenderer="NumberItemRenderer7"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="PCTRNU" headerText="Trans

            "

            textAlign="

             

            right" minWidth="50" itemRenderer="NumberItemRenderer8"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="PCINNU" headerText="Indp

            "

            textAlign="

             

            right" minWidth="50" itemRenderer="NumberItemRenderer9"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="PCWHNU" headerText="Whsl

            "

            textAlign="

             

            right" minWidth="50" itemRenderer="NumberItemRenderer10"

            />

             

             

            </mx:groupedColumns>

             

             

            </mx:AdvancedDataGrid>

             

             

            </mx:VBox>

             

            <mx:VBox

             

             

            width="100%" height="100%" >

             

             

            <mx:AdvancedDataGrid id="theDataGrid" width="100%" dataProvider="{myDep}" height="100%"

            >

             

             

             

            <mx:columns>

             

            <mx:AdvancedDataGridColumn

             

             

            dataField="theHeader" headerText="Product

            "

            minWidth="

             

            75"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="value" headerText="Month

            "

            minWidth="

             

            20"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="SDIVDE" headerText="Size

            "

            minWidth="

             

            50"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="ISCF5W" headerText="Pac" minWidth="20"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="DPBENU" headerText="Beg. Inv.

            "

            textAlign="

             

            right" minWidth="26"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="DPRENU" headerText="Receipt

            "

            textAlign="

             

            right" minWidth="26"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="DPTINU" headerText="TranfrIn

            "

            textAlign="

             

            right" minWidth="50"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="DPOUNU" headerText="TranfrOut

            "

            textAlign="

             

            right" minWidth="50"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="DPWHNU" headerText="WholeSale

            "

            textAlign="

             

            right" minWidth="50"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="DPSLNU" headerText="SaleTM

            "

            textAlign="

             

            right" minWidth="50"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="DPADNU" headerText="Adjust.

            "

            textAlign="

             

            right" minWidth="50"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="DPINNU" headerText="InTrans

            "

            textAlign="

             

            right" minWidth="50"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="DPENNU" headerText="End Inv.

            "

            textAlign="

             

            right" minWidth="50"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="DPCRNU" headerText="Cr/Db Adjust.

            "

            textAlign="

             

            right" minWidth="50"

            />

            <mx:AdvancedDataGridColumn

             

             

            dataField="DPDPNU" headerText="Depletions

            "

            textAlign="

             

            right" minWidth="50"

            />

             

             

            </mx:columns>

             

             

            </mx:AdvancedDataGrid>

             

             

            </mx:VBox>

             

             

             

            </mx:Accordion>

             

             

            <mx:VBox width="100%"

            >

            </mx:VBox>

             

             

             

            </mx:Panel>

             

            </mx:Application>