It sounds like you just need to catch the column header mouse down event, prevent default and execute your server calling code...
Good luck, Evyatar On Apr 29, 2013 4:03 PM, "Adnan Doric" <[email protected]> wrote: > Hey, thank you for trying to help. > In fact, I don't want to implement lazy loading, it is a lot simpler then > that: I just want the DataGrid to avoid sorting all together and let me > populate "manually" the dataProvider. > > Please take a look at the following Gist, it is a small example > illustrating the issue: > https://gist.github.com/**adnandoric/5481416<https://gist.github.com/adnandoric/5481416> > > As you will see, the moment you click on the column header, DataGrid > immediately sort it even though I explicitly set the sortCompareFunction > that returns null. I'm probably doing it wrong. > > What I would like is to have DataGrid not sorting or doing anything at all > when I click on the header and let me handle the whole operation. At the > end, when data arrives from the backend, I would just need to adjust the > sortIndicator which is apparently possible using sortDescending, thank you > for that information :) > > So, what do you think about this ? Feel free to fork the gist :) > > Thank you, > Adnan > > > On 29/04/2013 13:13, Julio Carneiro wrote: > >> 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/<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 >> >> >> >> >
