I just went through the same exercise, and ended up using the
"recommended" method, which is creating your own Sort object...

The basic working is to

1. take a collection (either arraycollection or xmllistcollection) as
dataprovider
2. define a Sort object for it (you do this by creating SortFields and
putting them into the fields array of the Sort object)
3. execute a Refresh on your collection

If you trigger your sort via HeaderRelease events, you should call
preventDefault() in that handler so that only your sort gets executed.

You can find code samples if you look in the docs (the example I used
was about sorting multiple columns at the same time)

HTH
--- In flexcoders@yahoogroups.com, "Robert Chyko" <[EMAIL PROTECTED]> wrote:
>
> One thing to look at would be dispatch a HEADER_RELEASE event on the
> datagrid. Its not the most straightforward fix, and will take a little
> tweaking to get to work right, but it is doable.
>
>
>
>
> -----Original Message-----
> From: flexcoders@yahoogroups.com
> [mailto:[EMAIL PROTECTED] On Behalf Of Adam Royle
> Sent: Thursday, March 01, 2007 8:09 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] simulate datagrid header click, or set
> default sort column
>
>
>
>
> Hi guys,
>
> This came up last week but no working response was given.
>
> I have my data sorted in a dataProvider, however whenever I add
> new data I add it to the end of the ArrayCollection. However this
means
> the datagrid is no longer sorted correctly.
>
> I wish I could execute the private method sortByColumn() that
> exists in the DataGrid class, but it's private!!
>
> Anyone with a solution? I have tried subclassing and also
> copying code directly, but the sortByColumn method uses private
> variables, so I'm stuck again.
>
> Can anyone suggest a solution to my problem?
>
> Cheers,
> Adam
>



Reply via email to