Ben,

No problem. I appreciate the thought and the response.

The column's 'visible' property only states whether the column should
be shown, not whether it is currently visible on the screen (I.E. a
column that is scrolled off the edge of the data grid is not visible
even though it's 'visible' property is true)

I believe the column's visible property relates to the DataGrid's
private list 'displayableColumns'
    /**
     *  @private
     *  Columns with visible="true"
     */
    private var displayableColumns:Array;

and the DataGrid's 'visibleColumns' list are ones that are actually
visible to the user.

Anyway, I think I have a relatively OK workaround for now, I just put
a try/catch block around the call, and ignore any errors... its
working so far. =)

thanks,
PW


--- In flexcoders@yahoogroups.com, "ben.clinkinbeard"
<[EMAIL PROTECTED]> wrote:
>
> Sorry if I am being really dense but I take it you can't just check
> the "visible" property of the column?
> 
> Ben
> 
> 
> --- In flexcoders@yahoogroups.com, "parkerwhirlow" <parkerwhirlow@>
> wrote:
> >
> > So, I'm finding that this is really a nasty bug, and I haven't found a
> > good work-around.
> > 
> > I've tried searching through the DataGrid.columnMap to ensure there's
> > renderers for my column before setting the width. This works until you
> > scroll horizontally. The columns that used to be visible, but aren't
> > anymore still have renderers in columnMap... and as soon as you set
> > the width on a non-visible column, bam... null reference error.
> > 
> > I've submitted a bug report on Flex 2.0.1 through the normal feedback
> > channel.
> > 
> > Still looking for some kind of work-around if anyone knows of one, I
> > really need something!
> > 
> > thanks,
> > PW
> > 
> > --- In flexcoders@yahoogroups.com, "parkerwhirlow" <parkerwhirlow@>
> > wrote:
> > >
> > > Hi,
> > > 
> > > I have an issue where I've created a special routine to
calculate the
> > >  size of the columns in my DataGrid subclass. 
> > > 
> > > The problem I have is that I have several data grids that interact
> > > with eachother, and not all columns are visible (or were ever
> visible). 
> > > 
> > > When I programmatically set the width of the columns, if the columns
> > > have not been shown (are not in the 'visibleColumns' array) I get a
> > > null pointer error. See the stack trace below.
> > > 
> > > Since I can't get to the 'visibleColumns' collection, how can I set
> > > the 'desired' widths of my columns without running into this error?
> > > 
> > > Also, looking at the actual code, they tried to check for some
timing
> > > on whether they had calc'd columns. But they don't check if the
column
> > > you're setting the width on is in the 'visibleColumns' list. This
> > > seems like a relatively simple defect to fix... It should fall into
> > > that upper if block, and set the width on the column itself, right?
> > > 
> > > 
> > > thanks,
> > > Parker Whirlow
> > > __________________________
> > > 
> > > TypeError: Error #1010: A term is undefined and has no properties.
> > > at
> > >
> >
>
mx.controls::DataGrid/http://www.adobe.com/2006/flex/mx/internal::resizeColumn()[C:\dev\flex_201_gmc\sdk\frameworks\mx\controls\DataGrid.as:2462]
> > > at mx.controls.dataGridClasses::DataGridColumn/set
> > >
> >
>
width()[C:\dev\flex_201_gmc\sdk\frameworks\mx\controls\dataGridClasses\DataGridColumn.as:1048]
> > > at
> > >
> >
>
company.visualizations::MyGrid/company.visualizations:MyGrid::setDefaultColumnWidths()[C:\work\Flex\src\company\visualizations\MyGrid.as:1720]
> > > 
> > > _________________________
> > > source at DataGrid:2462
> > > 
> > > // there's a window of time before we calc columnsizes
> > > // that someone can set width in AS
> > > if (!visibleColumns || visibleColumns.length == 0)
> > > {
> > >   columns[col].setWidth(w);
> > >   return;
> > > }
> > > 
> > > if (w < visibleColumns[col].minWidth)   // ERROR IS HERE
> > >   w = visibleColumns[col].minWidth;
> > >
> >
>


Reply via email to