you could actually, by subclassing the datagrid class
and exposing the private method sortByColumn - the
method called by header release event handler in the
datagrid as class file. However, I am more inclined to
sticking with adobe's private implementation of this
class and do the sorting instead at the dataprovider
level; that way you get finer control over the sorting
process.. then update the datagrid display :)
--- iko_knyphausen [EMAIL PROTECTED] wrote:
Hello everyone,
I would like to trigger a column sort
programmatically, as if the user
had clicked the column header. I have read many
posts, and LiveDocs
about this topic, and I did not like the solutions
presented there. My
grid has plenty of calculated display content
(labelFunctions and
custom itemRenderers), many columns require custom
sortFunctions. I
would like to use these functions exactly as they
are, just without
asking the user to click anything.
I came up with one way, which is to dispatch a
HEADER_RELEASE event (see
below utilized after a column drag), but that's a
bit like accelerating
a car by dispatching a PUSH_PEDAL event instead of
controlling the
engine directly - if that analogy makes any sense.
private function reGroup(event : IndexChangedEvent )
: void
{
dgItems.dispatchEvent(new
DataGridEvent(DataGridEvent.HEADER_RELEASE,false,false,event.newIndex));
}
What I was hoping for, would be a method like:
dataGrid.sortItemsBy(
ColumnIndex, [ASC|DESC] ) or dataGrid.sortItemsUsing
(
sortCompareFunction, [ASC|DESC] ). Some of that was
mentioned in the
early posts on this list, but it seemed to be
related to Flex 1.5
Thanks for any help, or input
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com