Thanks to all those who replied, Following links strategy does work for me,
My XML's structure was little weird and I was expecting to use some inbuilt
sorting capability but I guess as recommended by few folks I have to custom
and I followed the following link helpful, Anyone else is seeking soem
complex sortign the link might be helpful

http://www.parallelcoding.com/2008/10/20/sorting-a-xmllistcollection-in-flex/



On Mon, Mar 9, 2009 at 1:09 PM, foobone9 <foobo...@yahoo.com> wrote:

>   It's a class property array. That line is simply showing a way to fall
> back to other compare field properties if none are provided via the 'fields'
> parameter.
>
> --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, geeky
> developer <geekydevelo...@...> wrote:
> >
> > Hi foobone9I am trying to implement your sent/recommended code but it is
> not
>
> > recognizing internalPropList in line
> > var propList:Array = fields ? fields : internalPropList;.
> >
> > What exactly in internalPropList here?
> > Anyone has any idea,
> > Thanks all for your reply and help
> >
> > .
> >
> >
> > On Thu, Mar 5, 2009 at 4:57 PM, foobone9 <foobo...@...> wrote:
> >
> > >
> > > There is a nice example in the Sort class documentation:
> > >
> > >
> > >
> http://livedocs.adobe.com/flex/3/langref/mx/collections/Sort.html#compareFunction
> > >
> > >
> > > --- In flexcoders@yahoogroups.com 
> > > <flexcoders%40yahoogroups.com><flexcoders%
> 40yahoogroups.com>, crazy
> > > developer <geekydeveloper@> wrote:
> > > >
> > > > Hi Thanks for replying
> > > > What does we mean by custom sort compare function, Can we provide any
> > > > examples of both sort and sort compare functions or little more
> details
> > > > about what and how does we do that?
> > > > Thanks much fro your help
> > > >
> > > >
> > > >
> > > > On Thu, Mar 5, 2009 at 11:24 AM, Alex Harui <aharui@> wrote:
> > > >
> > > > > If you have a labelfunction, you'll probably need a custom
> sortcompare
> > > > > function
> > > > >
> > > > >
> > > > >
> > > > > Alex Harui
> > > > >
> > > > > Flex SDK Developer
> > > > >
> > > > > Adobe Systems Inc. <http://www.adobe.com/>
> > >
> > > > >
> > > > > Blog: http://blogs.adobe.com/aharui
> > > > >
> > > > >
> > > > >
> > > > > *From:* flexcoders@yahoogroups.com 
> > > > > <flexcoders%40yahoogroups.com><flexcoders%
> 40yahoogroups.com>[mailto:
> > > flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com> <flexcoders%
> 40yahoogroups.com>] *On
> > > > > Behalf Of *anuj181
> > > > > *Sent:* Wednesday, March 04, 2009 3:51 PM
> > > > > *To:* flexcoders@yahoogroups.com 
> > > > > <flexcoders%40yahoogroups.com><flexcoders%
> 40yahoogroups.com>
>
> > > > > *Subject:* [flexcoders] Problem in sorting XMLList collection as a
> > > > > dataProvider for the list
> > > > >
> > > > >
> > > > >
> > > > > Hi Guys
> > > > >
> > > > > I am trying to sort the xmllist collection which is the
> dataprovider
> > > for
> > > > > the list. As the implementation of name-value pairs, i am
> displaying
> > > the
> > > > > entries in form of string in List and would like to sort all the
> data
> > > > > displayed in the List alphabetically, I am making a call through
> amfphp
> > > call
> > > > > to grab data from backend and populate XMLListCollection but now I
> need
> > > to
> > > > > sort the data in the list. Below is the code,Can anyone please help
> me
> > > where
> > > > > I am messing things up. Also please let me know if there is any
> > > question
> > > > > regarding the code and if there is better way of doing it.
> > > > >
> > > > > Thanks
> > > > >
> > > > > /******************CODE************/
> > > > >
> > > > > <mx:RemoteObject id="amfSetup" source="Setup" destination="amfphp">
> > > > > <mx:method name="getList" result="getListHandler(event);"
> > > > > fault="getListFault(event);"/>
> > > > > </mx:RemoteObject>
> > > > >
> > > > > [Bindable] private var entriesXmlListFull:XMLList;
> > > > > [Bindable] private var entriesXmlCollection:XMLListCollection;
> > > > >
> > > > >
> > > > > public function getListHandler(event:ResultEvent):void
> > > > > {
> > > > >
> > > > > entriesXmlListFull = XML(event.result).device;
> > > > > populateEntries();
> > > > > }
> > > > > private function getListFault(event:FaultEvent):void
> > > > > {
> > > > > Alert.Show("Error retreiving Data");
> > > > > }
> > > > >
> > > > > //Displaying names need to be displayed in the List box
> > > > > private function entriesLabelFunc(item:Object):String
> > > > > {
> > > > > var xmlItem:XML = item as XML;
> > > > >
> > > > > return xmlItem..attribute.(@name=="friendlyname");
> > > > > }
> > > > >
> > > > > //Populating List with XML Objects
> > > > > private function populateEntries():void
> > > > > {
> > > > > entriesXmlCollection = new XMLListCollection();
> > > > >
> > > > > for each(var item:XML in entriesXmlListFull)
> > > > > {
> > > > >
> > > > > var friendlyName:String = item..attribute.(@name=="friendlyname");
> > > > > //Only add camera type
> > > > > if ( !recordValue && hasFriendlyName && (itemType.toUpperCase() ==
> > > > > "CAMERA") )
> > > > > {
> > > > > entriesXmlCollection.addItem(item);
> > > > > }
> > > > > }
> > > > >
> > > > > //Calling Sort on XMLList collection
> > > > > entriesXmlCollection.sort = sortList;
> > > > > entriesXmlCollection.refresh();
> > > > >
> > > > >
> > > > > }
> > > > >
> > > > >
> > > > > <mx:Sort id="sortList">
> > > > > <mx:fields>
> > > > > <mx:SortField name="*" caseInsensitive="true" />
> > > > > </mx:fields>
> > > > > </mx:Sort>
> > > > >
> > > > > <mx:List id="listData" dataProvider="{entriesXmlCollection}"
> > > > > labelFunction="entriesLabelFunc"/>
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> >
>
>  
>

Reply via email to