Flex. pushView data Object being converted into a String

泄露秘密 提交于 2019-12-11 16:52:55

问题


After executing a navigator.pushView with data object, I'm in need of the data object to be received into the next view, but at some stage transformed into a string to use in a sql function. The code below shows what I'm working on at the moment.

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark" title="{data.toString()}"
    xmlns:model="model.*"
    creationComplete  = "{data=srv.findByCategory(data.toString())}"
    >

.toString() was my quick attempt at it, but the resultant output is simply

[object Object]

There aren't any errors but it only shows during debug.

Any ideas?


As appendage, here is the code from the initial view where the data object originates from

<s:List id="list" top="0" bottom="0" left="0" right="0" width="100%"
        alternatingItemColors="0xffffff"
        contentBackgroundColor="0xffffff"
        downColor="0xfc7d1a"
        selectionColor="0xfc7d1a"           
        dataProvider="{data}"
        labelFunction="getFullName"
        change="navigator.pushView(CategoryView, list.selectedItem.toString())">

And here is some of the code which needs the data object to be a String.

public function findByCategory(searchKey:String):ArrayCollection
        {
}

回答1:


data is a keyed object containing containing the info you passed from the initial view. You need to access the correct key in your object.

It should be something like data.myKey.toString(). I would be able to tell you exactly if you paste your pushView code.



来源:https://stackoverflow.com/questions/10483027/flex-pushview-data-object-being-converted-into-a-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!