0 Replies Latest reply on Jun 8, 2009 8:35 AM by salut

    Sorting data in a tree

    salut

      I'm trying to sort the data below according to title. Can someone point out what I am doing wrong? Thanks in advance

       

      <publicationTopics id=""9"">

       

      <topic topicId="8" defaultTopicOrder="1" name="Top Stories" parentId="0" isBranch="true">

       

      <article articleNum="1" articleOrder="2" contentContainerId="14" contentSourceId="1" itemDate="2009-06-05 00:00:00.0" pageId="270" teaser="abc" title="cc" topicId="12"/>

       

      <article articleNum="2" articleOrder="2" contentContainerId="14" contentSourceId="1" itemDate="2009-06-05 00:00:00.0" pageId="270" teaser="bbb" title="aa" topicId="12"/>

       

      </topic>

       

      <topic topicId="9" defaultTopicOrder=""28"" name=""Sixth District Banks and Economy"" parentId=""0"" isBranch=""true"" >

       

      <article articleNum=""0"" articleOrder=""0"" title=""place holder"" teaser=""place holder"" itemDate=""2009-04-15 00:00:00.0"" contentSourceId=""0"" contentContainerId=""0"" pageId=""259"" topicId=""9"" />

      <article articleNum=""4112577"" articleOrder=""1"" title=""v"" teaser=""sss"" itemDate=""2009-04-15 00:00:00.0"" contentSourceId=""1"" contentContainerId=""11"" pageId=""259"" topicId=""9"" />

       

      <article articleNum=""5"" articleOrder=""2"" title=""ggg"" teaser=""jjj."" itemDate=""2009-04-15 00:00:00.0"" contentSourceId=""1"" contentContainerId=""11"" pageId=""259"" topicId=""9"" />

       

      </topic>

       

      </publicationTopics>

       

       

          private function getPublicationArticlesByDateXMLResultHandler(event:ResultEvent):void
          {
                      issueContentsTree.enabled = true;
                      contentItemsXML = event.result as XML;
                      contentItemsXMLList = new XMLList(contentItemsXML.topic);
                      contentItemsXLC = new XMLListCollection(contentItemsXMLList);

       

                      var sort:Sort = new Sort();
                      sort.fields = [new SortField("title", false,false,true)];

                      //sort.fields = [new SortField(contentItemsXMLList..title, false,false,true)];
                
                      contentItemsXLC.sort = sort;
                      contentItemsXLC.refresh();        
                     
                      issueContentsTree.dataProvider = contentItemsXLC;
                     
                      // to expand all top topics when displaying the tree
                      this.validateNow();
                      issueContentsTree.expandChildrenOf(contentItemsXML,true);

         }