The code is crashing while removing column from AdvancedDataGrid.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • santusapi
    New Member
    • Mar 2010
    • 26

    #1

    The code is crashing while removing column from AdvancedDataGrid.

    Hello All,
    I am facing problem while removing the columns from
    AdvancedDataGri d. It is crashing at one point and i am unable to
    resolve it.

    The code i'm using to remove the columns is like this.
    Code:
                   public function clearPlot():void
                   {
                           cols = cols.slice(0, 0);
    
                           this.columns = cols;
                           this.validateNow();
                   }
    The class is extending AdvancedDataGri d and the variable "cols" is an
    Array type. And also i have tried many variations, but none of
    them solved the problem. So i'm giving the variations also.

    [1]
    Code:
                   public function clearPlot():void
                   {
                           cols = cols.slice(0, 0);
                           cols.push(new AdvancedDataGridColumn(""));
    
                           this.columns = cols;
                           this.validateNow();
                   }
    [2]
    Code:
                 public function clearPlot():void
                   {
                           cols = new Array();
                           cols.push(new AdvancedDataGridColumn("dummy"));
    
                           this.columns = cols;
                           this.validateNow();
                   }
    [3]
    Code:
                 public function clearPlot():void
                   {
                           cols = new Array();
    
                           this.columns = cols;
                           this.validateNow();
                   }
    [4]
    Code:
                 public function clearPlot():void
                   {
                           this.columns = null;
                           this.validateNow();
                   }
    [5]
    Code:
                 public function clearPlot():void
                   {
                           cols = null;
                           cols = new Array();
    
                           this.columns = cols;
                           this.validateNow();
                   }
    The error is like this:

    TypeError: Error #1009: Cannot access a property or method of a null
    object reference.
    at mx.controls::Ad vancedDataGridB aseEx/http://www.adobe.com/2006/flex/
    mx/internal::getHe aderInfo()[C:\work\flex\dm v_automation\pr ojects
    \datavisualisat ion\src\mx\cont rols\AdvancedDa taGridBaseEx.as :2366]
    at mx.controls::Ad vancedDataGrid/http://www.adobe.com/2006/flex/mx/
    internal::getHe aderInfo()[C:\work\flex\dm v_automation\pr ojects
    \datavisualisat ion\src\mx\cont rols\AdvancedDa taGrid.as:2147]
    at mx.controls::Ad vancedDataGrid/getFieldSortInf o()[C:\work\flex
    \dmv_automation \projects\datav isualisation\sr c\mx\controls
    \AdvancedDataGr id.as:6840]
    at
    mx.controls.adv ancedDataGridCl asses::Advanced DataGridHeaderR enderer/
    getFieldSortInf o()[C:\work\flex\dm v_automation\pr ojects
    \datavisualisat ion\src\mx\cont rols\advancedDa taGridClasses
    \AdvancedDataGr idHeaderRendere r.as:757]
    at
    mx.controls.adv ancedDataGridCl asses::Advanced DataGridHeaderR enderer/
    updateDisplayLi st()[C:\work\flex\dm v_automation\pr ojects
    \datavisualisat ion\src\mx\cont rols\advancedDa taGridClasses
    \AdvancedDataGr idHeaderRendere r.as:560]
    at mx.core::UIComp onent/validateDisplay List()[C:\autobuild
    \3.3.0\framewor ks\projects\fra mework\src\mx\c ore\UIComponent .as:6351]
    at mx.managers::La youtManager/validateDisplay List()[C:\autobuild
    \3.3.0\framewor ks\projects\fra mework\src\mx\m anagers\LayoutM anager.as:
    622]
    at mx.managers::La youtManager/doPhasedInstant iation()[C:\autobuild
    \3.3.0\framewor ks\projects\fra mework\src\mx\m anagers\LayoutM anager.as:
    695]
    at Function/http://adobe.com/AS3/2006/builtin::apply( )
    at mx.core::UIComp onent/callLaterDispat cher2()[C:\autobuild
    \3.3.0\framewor ks\projects\fra mework\src\mx\c ore\UIComponent .as:8628]
    at mx.core::UIComp onent/callLaterDispat cher()[C:\autobuild
    \3.3.0\framewor ks\projects\fra mework\src\mx\c ore\UIComponent .as:8568]


    And i'm giving the stack trace also. It is:
    mx.controls::Ad vancedDataGridB aseEx/http://www.adobe.com/2006/flex/mx/
    internal::getHe aderInfo
    mx.controls::Ad vancedDataGrid/http://www.adobe.com/2006/flex/mx/
    internal::getHe aderInfo
    mx.controls::Ad vancedDataGrid/getFieldSortInf o
    mx.controls.adv ancedDataGridCl asses::Advanced DataGridHeaderR enderer/
    getFieldSortInf o
    mx.controls.adv ancedDataGridCl asses::Advanced DataGridHeaderR enderer/
    updateDisplayLi st
    mx.core::UIComp onent/validateDisplay List
    mx.managers::La youtManager/validateDisplay List
    mx.managers::La youtManager/doPhasedInstant iation
    Function/http://adobe.com/AS3/2006/builtin::apply [no source]
    mx.core::UIComp onent/callLaterDispat cher2
    mx.core::UIComp onent/callLaterDispat cher


    Please help me in solving this.
Working...