本文介绍了柔性.pushView 数据对象被转换为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用数据对象执行 navigator.pushView 后,我需要将数据对象接收到下一个视图中,但在某个阶段转换为字符串以在 sql 函数中使用.下面的代码显示了我目前正在做的事情.

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() 是我的快速尝试,但结果输出只是

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

[对象对象]

没有任何错误,但仅在调试期间显示.

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

有什么想法吗?

作为附件,这里是初始视图中数据对象源自的代码

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
        {
}

推荐答案

data 是一个键控对象,其中包含您从初始视图传递的信息.您需要访问对象中的正确密钥.

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.

它应该类似于 data.myKey.toString().如果您粘贴 pushView 代码,我将能够准确地告诉您.

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

这篇关于柔性.pushView 数据对象被转换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 13:39