I've solved this problem in the past by using the sort() function of
the Array class, which takes a compare function as its only argument.
Assuming that you are using an array as the data provider of your
grid, you can sort the array and then display the sorted data in the
grid. You'll have to rig up some extra wiring if you want this to sort
on a user action (e.g. clicking a column header).

http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary068.html

Jim
 

On 5/4/05, Jeroen De Vos <[EMAIL PROTECTED]> wrote:
>  
> 
> Hi all, 
> 
> I'm writing a custom sort function that needs information from two colums to
> do the sorting. 
> 
> Example: 
> The data is formed like this: 
> TYPE    NAME 
> a       Test_1 
> b       Test_2 
> a       Test_3 
> a       Test_4 
> b       Test_5 
> 
> The TYPE column is not shown in the datagrid, only the NAME column is
> visible. 
> When sorting on the NAME column, the datagrid needs to take into account the
> TYPE column so that the result of the sort is: 
> 
> TYPE    NAME 
> a       Test_1 
> a       Test_3 
> a       Test_4 
> b       Test_2 
> b       Test_5 
> So, first sort on TYPE and then sort on NAME. 
> 
> How do I do this? 
> Can I use the sortCompareFunction of the datagridcolumn for this? I guess
> not because the objects in the parameters of the function are not the rows,
> but the values inside the column to be sorted. 
> 
> Thanks, 
> Jeroen. 
> 
> ________________________________ 
> 
> Jeroen De Vos 
> Gemeentelijk Havenbedrijf Antwerpen 
> C/ICT - AMARIS 
> ________________________________ 
> 
> Deze e-mail en alle gekoppelde bestanden zijn officiele documenten van het
> Gemeentelijk Havenbedrijf Antwerpen en kunnen vertrouwelijke of persoonlijke
> informatie bevatten. Gelieve de afzender onmiddellijk via e-mail of
> telefonisch te verwittigen als u deze e-mail per vergissing heeft ontvangen
> en verwijder vervolgens de e-mail zonder deze te lezen, te reproduceren, te
> verspreiden of te ontsluiten naar derden. Het Gemeentelijk Havenbedrijf
> Antwerpen is op geen enkele manier verantwoordelijk voor fouten of
> onnauwkeurigheden in de inhoud van deze e-mail. Het Gemeentelijk
> Havenbedrijf Antwerpen kan niet aansprakelijk gesteld worden voor directe of
> indirecte schade, verlies of ongemak veroorzaakt als gevolg van een
> onnauwkeurigheid of fout in deze e-mail. 
> 
> English Translation: This e-mail and all attached files are official
> documents of Antwerp Port Authority and may contain confidential or personal
> information. If you have received this e-mail in error, you are asked to
> inform the sender by e-mail or telephone immediately, and to remove it from
> your system without reading or reproducing it or passing it on to other
> parties. Antwerp Port Authority is in no way responsible for any errors or
> inaccuracies in the contents of this e-mail, nor can it be held liable for
> any direct or indirect loss, damage or inconvenience arising from any such
> errors or inaccuracies. [GHA#Disclaimer] 
>  ________________________________
>  Yahoo! Groups Links
>  
>  
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/flexcoders/
>   
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>   
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to