When a header gets clicked a HEADER_RELEASE event fires.  That's a good
opportunity to save away the sort information somewhere.  I once
recommended to someone that they actually subclass ArrayCollection and
override the sort property so it didn't actually sort the underlying
data, but instead called to the server.  In doing so, the DG would check
the sort on the collection and update the arrows correctly.  I don't
know if they got that to work, but it should.

 

Other than, simply storing the column index somewhere should be good
enough.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of e_baggg
Sent: Thursday, May 31, 2007 11:21 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: DataGrid HeaderRenderer Recreates every click

 

Alex-
Thanks. The issue is when a user clicks a column header, all the
column headers are re-created and now there is no way to know what
just happened since any state of that click event is lost. So I guess
I am forced to save it outside the headerRenderer. 

I suppose I can store the column index of what was clicked, then each
column when it redraws itself can get that int (if it's not -1), look
that value up in the 'columns' array and see if itself is it. If so,
then display the appropriate up/down arrow. 

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> People do some really tricky things in customized DGs like having
> headers grow and shrink or other rows grow and shrink based on
rollover
> states and selection and what not. Right now the DG aggressively
> redraws to make sure we don't make assumptions about what can change.
> 
> 
> 
> In theory, your custom header renderers should derive their state from
> some description of the sort. That's a good model/view design and the
> cost should be insignificant. Maybe the way you're checking is
> non-optimal.
> 
> 
> 
> -Alex
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of e_baggg
> Sent: Thursday, May 31, 2007 10:18 AM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] DataGrid HeaderRenderer Recreates every click
> 
> 
> 
> I have a server-side sort on my DataGrid which means I had to
> implement my own headerRenderer to handle the click event, sort, and
> server calls. 
> 
> I am trying to create the asc/desc arrow now but I realized that any
> click event on the DataGrid instantiates a new Object of the
> headerRenderer (all of them actually). In other words, my
> headerRenderer mxml implementation, the creationComplete event gets
> called any time ANYTHING is clicked in the grid, including a row.
> 
> This is a problem for many reasons, but the most significant one being
> that I cannot store the state if the column is ascending/descending
> based on the user's click. I could store this externally in the model
> but that is very bad b/c then I'd also have to store which column was
> clicked and then the other columns have to check if it is itself and
> remove the arrow if they have one. Does anyone know why the
> headerRenderer is re-creating an instance of itself every time or
> faced this issue?
> 
> Thanks in advance.
>

 

Reply via email to