I found the answer to the disappearing sort arrows from another question: Flex: Database driven DataGrid: arrows disappearing in a question answered by ili and adapted it to suit my code.
Because there were two columns sorted, the internal sortIndex
was -1 and consequently the sortArrow was null.
By picking a column to display the sort on (I used the primary sort column) and setting a sortIndex and direction, the sortArrow
now appears.
protected function headerReleaseListener(event:DataGridEvent):void
{
if(event.columnIndex == 0)
{
event.preventDefault();
var sort:Sort = new Sort();
sort.fields = [new SortField("@name",true, true), new SortField("@address",true, false)];
ArrayCollection(this.dataProvider).sort = sort;
ArrayCollection(this.dataProvider).refresh();
mx_internal::sortIndex = event.columnIndex;
mx_internal::sortDirection = (mx_internal::sortDirection == null || mx_internal::sortDirection == "ASC") ? "DESC" : "ASC";
placeSortArrow();
}
}