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