Yes, James Ward PagedList is the way to go if you want lazyloading.
Also, if you're sorting in the backend there is no reason to set a Sort again
in your dataProvider.
You can simply set the sort indicators by using something like:
columnHeaderGroup.visibleSortIndicatorIndices = new
<int>[_sortColumn];
Please not that visibleSortIndicatorIndices is a Vector, so if you are sorting
on multiple columns, you can set them all in the Vector.
As for the asc/desc indicators, you set them in the GridColumn 'sortDescending'
property.
hth
julio
On Apr 29, 2013, at 7:41 AM, Tom Chiverton <[email protected]> wrote:
> On 29/04/2013 10:56, Adnan Doric wrote:
>> Hello all,
>>
>> I would like to be able to click on Datagrid headers and trigger backend
>> call in order to paginate/sort/filter and send back an updated collection.
>> Datagrid should just display it as is.
>>
>> How can this be done with data grid sort indicators correctly reflecting the
>> state "ASC" or "DESC"?
> It's easier than you think.
> If you are already backing this with a server result, drop in James Ward's
> awesome PagedList connector to an AsyncListView as the dataprovider :
> http://www.jamesward.com/2010/10/11/data-paging-in-flex-4/
>
> Now just send the sort direction along with the call to the backend. You can
> get this by listening for gridClick events with (event.rowIndex ==
> -1)&&(event.columnIndex!=-1) and saving off the column name.
>
> Applying a matching Sort to the local dataProvider and it'll show the right
> indicators.
>
> Tom
--
Julio Carneiro