Hi Tracy
Finally I would be able to retrieve labels but sorry I used labelFunction
because for some reason labelfield is breaking other programmer's code: I
have no idea why.
So Below is my code. But Now I am doing some logical error. I am getting all
the values in an array but it gives all the entries in all the whole list.
For example if there are 10 values named friendly name I need the list to
show
Value 1
Value 2
Value 3
.
.
.
.

Value10 as 10 entries in the list but with my code it is showing
Value1,Value2....Value10 10times in 10 rows with 10 entries in each row 10
times . I guess I am messing up in the logic. Can you please help me to fix
this problem.
Thanks alot for all your help
Anuj

/*************************CODE*********************************/

    public var arrPoolNameText:Array=new Array();
            private function assignFriendlyName(item:Object):String
            {
                var devicesTextFN:XMLList =
devicesCollection.child("attributes").child("attribute");


                for each (var attributesInFriendlyPool:* in devicesTextFN)
                {
                    //Checks if the attribute name is pool
                    if([EMAIL PROTECTED] == 'friendly-name')
                    {
                        var poolnameText:String =
attributesInFriendlyPool.toString();
                        arrPoolNameText.push(poolnameText);
                    }
                }
                return arrPoolNameText.toString();
            }

<mx:List id="nvrsInPoolList" labelFunction="assignFriendlyName"
horizontalScrollPolicy="on" allowMultipleSelection="true"
dragMoveEnabled="true" dragEnabled="true" dropEnabled="true"
        y="105" x="17" height="462" width="294"/>
On Mon, Dec 1, 2008 at 6:36 PM, Tracy Spratt <[EMAIL PROTECTED]> wrote:

>    Skip the Array entirely.
>
>
>
> Use the "devicesCollection" directly as the dataProvider:
>
> nvrsInPoolList.dataProvider = devicesCollection;
>
>  Then do:
>
> <mx:List id="nvrsInPoolList"
> labelField="[EMAIL PROTECTED]" …/>
>
>
>
> labelField tells List what to display.
>
>
>
> Then nvrsInPoolList.selectedItem will contain the *entire xml node* and
> you can access any value from it,
>
>
>
> Tracy
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
> Behalf Of *anuj sharma
> *Sent:* Monday, December 01, 2008 4:27 PM
> *To:* [email protected]
> *Subject:* Re: [flexcoders] Is there any Name -Value Pair concept for
> Arrays?
>
>
>
> Hi Tracy
> Yes I have attached code to tell you exactly how I am doing this. I am
> assigning an Array to my dataProvider and my array consists of XML Nodes. I
> hope I answer all of your questions. I am putting array of XML Nodes as
> dataProviders in List. I hope the code below will help you. Please let me
> know how to solve the problem of displaying different entities as labels and
> values in the List.
> Thanks for all your help
> Anuj
>
> //MXML Code
> <mx:HTTPService id="devicesXML" method="GET" resultFormat="e4x"
>         result="devicesXMLHandler(event)" showBusyCursor="true">
>     </mx:HTTPService>
>
> <mx:List id="nvrsInPoolList" allowMultipleSelection="true"
> dragMoveEnabled="true" dragEnabled="true" dropEnabled="true"
>         y="105" x="17" height="462" width="294"/>
>
> //Action Script Code
>
> [Bindable]
> private var devicesInList:Array=new Array();
> [Bindable]
> private var devicesList:XMLList;
> [Bindable]
> private var poolsList:XMLList;
> [Bindable]
> private var devicesCollection:XMLListCollection;
>
>
> public function init()
> {
> devicesXML.url="http://121.0.30.6:8182/config/devices";;
>                     devicesXML.useProxy=false;
> }
> private function devicesXMLHandler(event:ResultEvent):void
>             {
>                 devicesList = event.result.device;
>                 devicesCollection = new XMLListCollection(devicesList);
>
>                //Checks every device
>                 for each (var devicesInPool:* in devicesList) {
>                     var deviceName:String = [EMAIL PROTECTED];
>                     var label:[EMAIL PROTECTED];
>
>                     devicesInList.push(deviceName);
> }
>     nvrsInPoolList.dataProvider = devicesInList;
> }
>
>
> On Mon, Dec 1, 2008 at 1:24 PM, Tracy Spratt <[EMAIL PROTECTED]>
> wrote:
>
> dataProviders do not "display" anything.  But whatever your display
> component, there is a way to specify which property on the item you want to
> display.
>
>
>
> You say your dataProvider is an "array".  Are you sure?  How are you sure?
> Are you using the work "array" in its purely technical sense, or in a more
> generic sense, that includes "associative array" and "arrayCollection"?
>
>
>
> If it is an Array, what is it an array of? (dynamic objects, scalar values,
> xml nodes?)
>
>
>
> What is your resultFormat?
>
>
>
> Have you inspected your data in the result handler function?
>
>
>
> Tracy
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
> Behalf Of *anuj181
> *Sent:* Monday, December 01, 2008 2:48 PM
> *To:* [email protected]
> *Subject:* [flexcoders] Is there any Name -Value Pair concept for Arrays?
>
>
>
> Hi All
> I am retrieving some data using HTTP from PostGres database. I would
> be successfully able to put all the entries in UDN's in the list box
> (using REST Calls). Now my requirement is that I need to display an
> attribute name Friendly name which is already in the database as the
> label (VISUAL entry ) in the list but when user performs different
> operations like drag and drop, I need the complete string in form XML
> to be send. So to make long story short I need to display friendly
> name as list entries but behind the curtain that label have exact
> complete value coming from the Database. Now is there any way that I
> can tell my data provider (which is an Array in my case) that to
> display just the specific attribute for the database and while doing
> operation send the whole value.
> Any links, examples and help will be appreciated.
> Thanks
> Anuj
>
>
>
>  
>

Reply via email to