Here's a solution I picked up off the forums a while back. You'll need to edit QueryWidget.mxml and recompile. In the function onResult, add the middle line as shown in the first code snippet to call a sorting function for the query results. queryResultAC = createQueryResults(featureSet); queryResultAC = SortDataGridData("title",queryResultAC); addSharedData(widgetTitle, queryResultAC);Then put this sorting function somewhere in the module. 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; }
queryResultAC = createQueryResults(featureSet); queryResultAC = SortDataGridData("title",queryResultAC); addSharedData(widgetTitle, queryResultAC);
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; }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.