将多个字符串和数组组合到一个 dataProvider 中以生成 Spark 列表

发布于 2024-10-08 07:37:21 字数 726 浏览 0 评论 0原文

我正在努力解决这个问题,我需要做的是将 5 个数组与 5 个单独的字符串(来自 JSON Web 服务)合并到 FlashBuilder Burrito 中的一个列表项中。

Web服务返回数据如下

Title(String)
Array[0[name, size, imageurl]][1[name, size, imageurl]][2[name, size, imageurl]]

Title_1(String)
Array_1[0[name, size, imageurl]][1[name, size, imageurl]][2[name, size, imageurl]]

Title_2(String)
Array_2[0[name, size, imageurl]][1[name, size, imageurl]][2[name, size, imageurl]]

Title_3(String)
Array_3[0[name, size, imageurl]][1[name, size, imageurl]][2[name, size, imageurl]]

依此类推。我已经成功地将它们拉出来,并且每一个都在调试器中进行跟踪,尽管因为我需要将它们全部放在同一个列表中,所以我正在努力将它们一起建立为数据提供者。

如果我将字符串和数组放在一起,则无法正确读取,因为主标题与数组中产品的任何描述符处于不同的级别。所以我有点卡住了!

关于如何最好地解决这个问题有什么建议吗?

干杯

I'm struggling with this one, what I need to do is combine 5 arrays with 5 individual strings (which have come from a JSON webservice) into one single list item in FlashBuilder Burrito.

The web service returns data as follows

Title(String)
Array[0[name, size, imageurl]][1[name, size, imageurl]][2[name, size, imageurl]]

Title_1(String)
Array_1[0[name, size, imageurl]][1[name, size, imageurl]][2[name, size, imageurl]]

Title_2(String)
Array_2[0[name, size, imageurl]][1[name, size, imageurl]][2[name, size, imageurl]]

Title_3(String)
Array_3[0[name, size, imageurl]][1[name, size, imageurl]][2[name, size, imageurl]]

And so on. I've pulled these out successfully and each one traces in the debugger, although as I need them all in the same list I'm struggling to establish them as a dataprovider together.

If I push the strings and arrays together it is impossible to read properly, as the main Titles are at a different level to any descriptors for the products which are in the arrays. So I'm sort of stuck!!

Any advice on how best to approach this?

Cheers

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

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

发布评论

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

评论(1

遥远的她 2024-10-15 07:37:21

如何最好地解决这个问题实际上取决于应用程序的设计。如果列表要根据属性(名称、大小、价格等)进行排序,那么您可能希望将“类型”推入数组中,而不是使用标签,并有办法在项目渲染器中显示它。如果项目应该按类型分隔,但也可以排序,您可能需要考虑使用手风琴类型控件并拥有单独的列表。

无论如何,您想要做的是将数组连接成一个数组,并将“标题”作为属性推入对象中。这样您至少可以对标题进行排序,以便项目以正确的顺序显示在单个列表中。

否则,您可以创建一个自定义控件,其中 5 个不同的列表堆叠在一起(没有滚动条),并让自定义控件使用单个滚动条处理所有 5 个列表的滚动。

Really depends on the design of the application on how to best approach this. If the list is going to be sortable on the properties (Name, Size, Price etc) then instead of labels you might want to push the "type" into the array and have a way of showing this in the item renderer. If the items are supposed to be separated by type, but also sortable you might want to look at using an accordion type control and having separate lists.

Anyhow what you want to do is concatenate the arrays into a single array and push the "Title" into the object as a property. This way you can at least sort on the title so the items appear in the correct order in the single list.

Otherwise you could just create a custom control with 5 different lists stacked on top of each other (With no scrollbars) and have the custom control handle scrolling of all 5 lists with a single scroll bar.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文