4 Replies Latest reply on Jun 23, 2009 5:30 AM by Hemant Kumrawat

    How to Refressh AdvanceDataGrid Component.

    Hemant Kumrawat

      Hi ,

      i am useing following technique to bind advancedataGrid component to webservice

       

       

       

       

       

       

      <mx:GroupingCollection

       

      id="gc" source="{wsImthePM.getOperation('GetAllProjectToDos').lastResult}"

      >

       

       

      <mx:Grouping>

       

       

      <mx:GroupingField name="TaskName"

      >

       

       

      </mx:GroupingField>

       

       

      </mx:Grouping>

       

       

      </mx:GroupingCollection>

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      <mx:AdvancedDataGrid x="10" y="10" id="adgPrjTask" doubleClickEnabled="true" itemClick="BindTask(event);" width="100%" height="100%" selectionMode="singleRow" initialize="gc.refresh();" dataChange="gc.refresh();" dataProvider="{gc}"

      >

       

       

      <mx:columns>

       

       

      <mx:AdvancedDataGridColumn headerText="ToDoTitle" dataField="ToDoTitle"

      />

       

       

      <mx:AdvancedDataGridColumn headerText="Part" dataField="Part"

      />

       

       

      <mx:AdvancedDataGridColumn headerText="Status" dataField="Status"

      />

       

       

      <mx:AdvancedDataGridColumn headerText="Progress" dataField="Progress"

      />

       

       

      <mx:AdvancedDataGridColumn headerText="Assignee" dataField="Assignee"

      />

       

       

      <mx:AdvancedDataGridColumn headerText="Start On" dataField="StartOn"

      />

       

       

      <mx:AdvancedDataGridColumn headerText="End On" dataField="EndOn"

      />

       

       

      <mx:AdvancedDataGridColumn headerText="Est. Hours" dataField="EstimatedHours"

      />

       

       

      <mx:AdvancedDataGridColumn headerText="Started On" dataField="StartedOn"

      />

       

       

      <mx:AdvancedDataGridColumn headerText="Ended On" dataField="EndedOn"

      />

       

       

      <mx:AdvancedDataGridColumn headerText="Used Hours" dataField="UsedHours"

      />

       

       

      </mx:columns>

       

       

      </mx:AdvancedDataGrid>

      Query:-

      My AdvancedDataGrid is successfully binded but i want to Refresh it when i click on other components like Linkbar,tabNavigator,button etc.

       

      please solve my problem.

        • 1. Re: How to Refressh AdvanceDataGrid Component.
          Benji2008 Level 1

          making a button with a click action doing "gc.refresh()" doesnt do the trick ?

          • 2. Re: How to Refressh AdvanceDataGrid Component.
            Hemant Kumrawat Level 1

            No, it's not working.

            I get error when grid intialize. Detail of error is:

            -------------------------------------------------------------------------------

             

            TypeError: Error #1009: Cannot access a property or method of a null object reference.
            at mx.collections::GroupingCollection/getDataLabel()[C:\work\flex\dmv_automation\projects\da tavisualisation\src\mx\collections\GroupingCollection.as:769]
            at mx.collections::GroupingCollection/buildGroups()[C:\work\flex\dmv_automation\projects\dat avisualisation\src\mx\collections\GroupingCollection.as:1202]
            at mx.collections::GroupingCollection/makeGroupedCollection()[C:\work\flex\dmv_automation\pr ojects\datavisualisation\src\mx\collections\GroupingCollection.as:1128]
            at mx.collections::GroupingCollection/refresh()[C:\work\flex\dmv_automation\projects\datavis ualisation\src\mx\collections\GroupingCollection.as:470]
            at imthePM/__adgPrjTask_initialize()[D:\Flex Projects\ImthePM\src\imthePM.mxml:772]
            at flash.events::EventDispatcher/dispatchEventFunction()
            at flash.events::EventDispatcher/dispatchEvent()
            at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9298]
            at mx.core::UIComponent/set processedDescriptors()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UICom ponent.as:1217]
            at mx.core::UIComponent/initializationComplete()[C:\autobuild\3.2.0\frameworks\projects\fram ework\src\mx\core\UIComponent.as:5395]
            at mx.core::UIComponent/initialize()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx \core\UIComponent.as:5379]
            at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.2.0\frameworks\pro jects\framework\src\mx\core\UIComponent.as:5267]
            at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.2.0\frameworks\pro jects\framework\src\mx\core\Container.as:3305]
            at mx.core::Container/addChildAt()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\c ore\Container.as:2217]
            at mx.core::Container/addChild()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\cor e\Container.as:2140]
            at mx.core::Container/createComponentFromDescriptor()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\core\Container.as:3681]
            at mx.core::Container/createComponentsFromDescriptors()[C:\autobuild\3.2.0\frameworks\projec ts\framework\src\mx\core\Container.as:3493]
            at mx.core::Container/createChildren()[C:\autobuild\3.2.0\frameworks\projects\framework\src\ mx\core\Container.as:2589]
            at mx.core::UIComponent/initialize()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx \core\UIComponent.as:5370]
            at mx.core::Container/initialize()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\c ore\Container.as:2526]
            at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.2.0\frameworks\pro jects\framework\src\mx\core\UIComponent.as:5267]
            at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.2.0\frameworks\pro jects\framework\src\mx\core\Container.as:3305]
            at mx.core::Container/addChildAt()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\c ore\Container.as:2217]
            at mx.core::Container/addChild()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\cor e\Container.as:2140]
            at mx.core::Container/createComponentFromDescriptor()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\core\Container.as:3681]
            at mx.core::Container/createComponentsFromDescriptors()[C:\autobuild\3.2.0\frameworks\projec ts\framework\src\mx\core\Container.as:3493]
            at mx.core::Container/createChildren()[C:\autobuild\3.2.0\frameworks\projects\framework\src\ mx\core\Container.as:2589]
            at mx.core::UIComponent/initialize()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx \core\UIComponent.as:5370]
            at mx.core::Container/initialize()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\c ore\Container.as:2526]
            at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.2.0\frameworks\pro jects\framework\src\mx\core\UIComponent.as:5267]
            at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.2.0\frameworks\pro jects\framework\src\mx\core\Container.as:3305]
            at mx.core::Container/addChildAt()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\c ore\Container.as:2217]
            at mx.core::Container/addChild()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\cor e\Container.as:2140]
            at mx.core::Container/createComponentFromDescriptor()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\core\Container.as:3681]
            at mx.core::Container/createComponentsFromDescriptors()[C:\autobuild\3.2.0\frameworks\projec ts\framework\src\mx\core\Container.as:3493]
            at mx.containers::ViewStack/instantiateSelectedChild()[C:\autobuild\3.2.0\frameworks\project s\framework\src\mx\containers\ViewStack.as:1140]
            at mx.containers::ViewStack/commitProperties()[C:\autobuild\3.2.0\frameworks\projects\framew ork\src\mx\containers\ViewStack.as:664]
            at mx.containers::TabNavigator/commitProperties()[C:\autobuild\3.2.0\frameworks\projects\fra mework\src\mx\containers\TabNavigator.as:504]
            at mx.core::UIComponent/validateProperties()[C:\autobuild\3.2.0\frameworks\projects\framewor k\src\mx\core\UIComponent.as:5807]
            at mx.managers::LayoutManager/validateProperties()[C:\autobuild\3.2.0\frameworks\projects\fr amework\src\mx\managers\LayoutManager.as:539]
            at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\managers\LayoutManager.as:689]
            at Function/http://adobe.com/AS3/2006/builtin::apply()
            at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framew ork\src\mx\core\UIComponent.as:8628]
            at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8568]

            Please tell me the reason of error. Thanks in advance.

            • 3. Re: How to Refressh AdvanceDataGrid Component.
              *Prashant Shelke* Level 4

              I think at the time of intialization gc is null. You can do one thing make one function as below & then call it as required..


              function(){

                   if(gc != null )

                        gc.refresh();

              }

              • 4. Re: How to Refresh AdvanceDataGrid Component.
                Hemant Kumrawat Level 1

                Hi,

                Thanks for your reply but still my problem is unsolved.

                Can anyone tell me the reason of error?