将内容加载到 TextInput Flex 中?

发布于 2024-08-22 03:03:31 字数 864 浏览 11 评论 0原文

我使用查询和 ArrayCollection 将内容输入到我的应用程序中。我知道如何使用 dataProvider 属性将内容显示到 DataGrid 中,但我想使用 TextInput 组件并完全删除 DataGrid。

有谁有关于我如何做到这一点的示例或信息吗?

谢谢!

感谢您的见解 - invertedSpear

我仍然遇到一个问题,所有显示的都是 [object,object]

这是我的一些代码。

        [Bindable]
        private var acCon:ArrayCollection;

        private function reData():void //RETRIEVE DATA
        {
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConn;
            stmt.text = "SELECT * FROM person";
            stmt.execute();
            var result:SQLResult = stmt.getResult();
            acCon = new ArrayCollection(result.data);
        }

    <mx:Repeater id="repeater1" dataProvider="{acCon}"> 
    <mx:Label id="Label1" text="{repeater1.currentItem}"/>
  </mx:Repeater>

有什么想法吗?

I've got content coming into my application using a query and an ArrayCollection. I know how to display the content into a DataGrid by using the dataProvider propriety, but I'd like to use TextInput components and drop the DataGrid altogether.

Does anyone have any examples or information on how I would go about doing this?

Thanks!

Thank you for the insight - invertedSpear

I'm still having a problem all that displays is [object,object]

Here is a bit of my code.

        [Bindable]
        private var acCon:ArrayCollection;

        private function reData():void //RETRIEVE DATA
        {
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConn;
            stmt.text = "SELECT * FROM person";
            stmt.execute();
            var result:SQLResult = stmt.getResult();
            acCon = new ArrayCollection(result.data);
        }

    <mx:Repeater id="repeater1" dataProvider="{acCon}"> 
    <mx:Label id="Label1" text="{repeater1.currentItem}"/>
  </mx:Repeater>

Any thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彼岸花似海 2024-08-29 03:03:31

你的问题不清楚。查询结果的格式以及您想要显示它们的确切方式会对此产生影响。

无论格式如何,您都需要做的事情。

1) 确保您有一个可绑定变量来存储您的查询结果:

[Bindable] public var myArrayCollection:ArrayCollection = new ArrayCollection();

2) 将您的查询结果分配给它。

3)可能需要根据结果长度使用循环或中继器,不确定结果是什么样子,所以你必须弄清楚这一点。

4) 将值分配给文本框。

<mx:Text text="{myArrayCollection.FieldName}">

这个答案是我对你的问题的最佳猜测。如果此答案不适合您,请编辑您的问题以使其更清楚。

看看你现在的代码示例,我猜你已经非常接近了,你的中继器有点像你的查询结果。当前项目就像您的查询的一行。您可能只需要向其中添加字段名称。所以也许:

<mx:Label id="Label1" text="{repeater1.currentItem.LastName}"/> 

Your question is not clear. The format of your query result and exactly how you are wanting to display them make a difference in this.

Things you need to do no matter what the format.

1) make sure you have a bindable variable to store your query result in:

[Bindable] public var myArrayCollection:ArrayCollection = new ArrayCollection();

2) assign you query result to this.

3) probably going to need to use a loop or a repeater based on your results length, not sure what your result looks like so you will have to figure this out.

4) assign the values to text boxes.

<mx:Text text="{myArrayCollection.FieldName}">

This answer is my best guess to what your question is. Please edit your question to make it more clear if this answer doesn't work for you.

Looking at your code example that's now up I am guessing you are very close, your repeater is kind of like your query result. Current item is like a row of your query. you probably just need to add the field name to it. So Maybe:

<mx:Label id="Label1" text="{repeater1.currentItem.LastName}"/> 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文