Select to view content in your preferred language

query widget sorting

926
3
05-09-2011 09:32 AM
glennhazelton
Deactivated User
i am wondering if there is a way to control the display order of features returned by the query widget.
i understand i can use the filter option to do a subselection but the listing appears to be in the order of the Objectid. is there anyway to get it to be ordered based on a different field?
Tags (2)
0 Kudos
3 Replies
DaveKirkley
Occasional Contributor
You need to add this code to QueryWidget.mxml
I'm also trying to find a way for it to filter Null values... all the best..


// sort field function- added by .....
   private function SortDataGridData(strFieldNameToSort:String,recACToSort:ArrayCollection):ArrayCollection{ 
   
    try{
     // CC -Orginal code by BJ and found at forum post http://forums.esri.com/Thread.asp?c=158&f=2421&t=285419&mc=6#msgid886159
     var dataSortField:SortField = new SortField();
     dataSortField.name=strFieldNameToSort;
     var alphabetDataSort:Sort = new Sort();
     alphabetDataSort.fields=[dataSortField];    
     recACToSort.sort=alphabetDataSort;
     recACToSort.refresh();
    }
    catch(error:Error){
    }
   
    return recACToSort;
0 Kudos
JoeSimpson
Deactivated User
I experienced the same issue. One workaround is to create a new "FID" field in your feature class, then rank the features in the order you want them to display in the query list. 

-Joe
0 Kudos
StuartBlumberg
Emerging Contributor
Dave,

Can I just post that entire code anywhere in the QueryWidget.mxml?  Or do I need to put it in a certain place?  I keep getting an error thrown.  Thanks.
0 Kudos