Re: [flexcoders] Re: Problem in sorting XMLList collection as a dataProvider for the list

2009-03-10 Thread geeky developer
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  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 , geeky
> developer  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  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 
> > >  40yahoogroups.com>, crazy
> > > developer  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  wrote:
> > > >
> > > > > If you have a labelfunction, you'll probably need a custom
> sortcompare
> > > > > function
> > > > >
> > > > >
> > > > >
> > > > > Alex Harui
> > > > >
> > > > > Flex SDK Developer
> > > > >
> > > > > Adobe Systems Inc. 
> > >
> > > > >
> > > > > Blog: http://blogs.adobe.com/aharui
> > > > >
> > > > >
> > > > >
> > > > > *From:* flexcoders@yahoogroups.com 
> > > > >  40yahoogroups.com>[mailto:
> > > flexcoders@yahoogroups.com   40yahoogroups.com>] *On
> > > > > Behalf Of *anuj181
> > > > > *Sent:* Wednesday, March 04, 2009 3:51 PM
> > > > > *To:* flexcoders@yahoogroups.com 
> > > > >  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/
> > > > >
> > > > > 
> > > > >  > > > > fault="getListFault(event);"/>
> > > > > 
> > > > >
> > > > > [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();
> > > > >
> > > > >
> > > > > }
> > > > >
> > > > >
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > >

[flexcoders] Re: Problem in sorting XMLList collection as a dataProvider for the list

2009-03-09 Thread foobone9
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, geeky developer  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  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 , crazy
> > developer  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  wrote:
> > >
> > > > If you have a labelfunction, you'll probably need a custom sortcompare
> > > > function
> > > >
> > > >
> > > >
> > > > Alex Harui
> > > >
> > > > Flex SDK Developer
> > > >
> > > > Adobe Systems Inc. 
> >
> > > >
> > > > Blog: http://blogs.adobe.com/aharui
> > > >
> > > >
> > > >
> > > > *From:* flexcoders@yahoogroups.com 
> > > > [mailto:
> > flexcoders@yahoogroups.com ] *On
> > > > Behalf Of *anuj181
> > > > *Sent:* Wednesday, March 04, 2009 3:51 PM
> > > > *To:* flexcoders@yahoogroups.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/
> > > >
> > > > 
> > > >  > > > fault="getListFault(event);"/>
> > > > 
> > > >
> > > > [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();
> > > >
> > > >
> > > > }
> > > >
> > > >
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > >
> > > >  > > > labelFunction="entriesLabelFunc"/>
> > > >
> > > >
> > > >
> > >
> >
> >  
> >
>




Re: [flexcoders] Re: Problem in sorting XMLList collection as a dataProvider for the list

2009-03-06 Thread geeky developer
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  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 , crazy
> developer  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  wrote:
> >
> > > If you have a labelfunction, you'll probably need a custom sortcompare
> > > function
> > >
> > >
> > >
> > > Alex Harui
> > >
> > > Flex SDK Developer
> > >
> > > Adobe Systems Inc. 
>
> > >
> > > Blog: http://blogs.adobe.com/aharui
> > >
> > >
> > >
> > > *From:* flexcoders@yahoogroups.com [mailto:
> flexcoders@yahoogroups.com ] *On
> > > Behalf Of *anuj181
> > > *Sent:* Wednesday, March 04, 2009 3:51 PM
> > > *To:* flexcoders@yahoogroups.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/
> > >
> > > 
> > >  > > fault="getListFault(event);"/>
> > > 
> > >
> > > [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();
> > >
> > >
> > > }
> > >
> > >
> > > 
> > > 
> > > 
> > > 
> > > 
> > >
> > >  > > labelFunction="entriesLabelFunc"/>
> > >
> > >
> > >
> >
>
>  
>


[flexcoders] Re: Problem in sorting XMLList collection as a dataProvider for the list

2009-03-05 Thread foobone9

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, crazy developer  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  wrote:
> 
> >If you have a labelfunction, you'll probably need a custom sortcompare
> > function
> >
> >
> >
> > Alex Harui
> >
> > Flex SDK Developer
> >
> > Adobe Systems Inc. 
> >
> > Blog: http://blogs.adobe.com/aharui
> >
> >
> >
> > *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
> > Behalf Of *anuj181
> > *Sent:* Wednesday, March 04, 2009 3:51 PM
> > *To:* flexcoders@yahoogroups.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/
> >
> > 
> >  > fault="getListFault(event);"/>
> > 
> >
> > [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();
> >
> >
> > }
> >
> >
> > 
> > 
> > 
> > 
> > 
> >
> >  > labelFunction="entriesLabelFunc"/>
> >
> >   
> >
>