Return-Path: X-Original-To: apmail-flex-users-archive@www.apache.org Delivered-To: apmail-flex-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 99EB1102FF for ; Mon, 29 Apr 2013 13:46:55 +0000 (UTC) Received: (qmail 42711 invoked by uid 500); 29 Apr 2013 13:46:55 -0000 Delivered-To: apmail-flex-users-archive@flex.apache.org Received: (qmail 42589 invoked by uid 500); 29 Apr 2013 13:46:55 -0000 Mailing-List: contact users-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@flex.apache.org Delivered-To: mailing list users@flex.apache.org Received: (qmail 42577 invoked by uid 99); 29 Apr 2013 13:46:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Apr 2013 13:46:54 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of webdoublefx@hotmail.com designates 157.55.0.227 as permitted sender) Received: from [157.55.0.227] (HELO dub0-omc1-s28.dub0.hotmail.com) (157.55.0.227) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Apr 2013 13:46:49 +0000 Received: from DUB118-DS14 ([157.55.0.237]) by dub0-omc1-s28.dub0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 29 Apr 2013 06:46:28 -0700 X-EIP: [futjjMpwVnnYJF3/t08X1QhUGw0N1tWG] X-Originating-Email: [webdoublefx@hotmail.com] Message-ID: From: =?iso-8859-1?Q?Fr=E9d=E9ric_THOMAS?= To: References: <517E43C5.5080202@gmail.com><517E4E69.7060400@extravision.com><517E6F83.4040903@gmail.com> In-Reply-To: Subject: Re: Spark Datagrid backend sorting possible ? Date: Mon, 29 Apr 2013 15:46:27 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 16.4.3505.912 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3505.912 X-OriginalArrivalTime: 29 Apr 2013 13:46:28.0510 (UTC) FILETIME=[F2F8A3E0:01CE44DF] X-Virus-Checked: Checked by ClamAV on apache.org Or maybe overriding Datagrid->sortByColumns, not calling super and simply returning false/true depending if you want them considered as sorted or not; -Fred -----Message d'origine----- From: Evyatar Ben Halevi-Arbib Sent: Monday, April 29, 2013 3:29 PM To: users@flex.apache.org Subject: Re: Re: Spark Datagrid backend sorting possible ? 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" 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 > > 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 >> [_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 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 >> >> >> >> >