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; }
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.