Sproutcore - gridview分组

发布于 2024-10-28 16:39:54 字数 438 浏览 2 评论 0原文

SC.Gridview支持分组吗?如果是这样,有人可以给我一些如何开始的指导吗?

我正在尝试构建分成逻辑组的图块的网格视图。我的基础模型类似于以下内容:

TestApp.personModel.FIXTURES = [

  {
    "name" : "Bob",
    "group" : "group1"
  },

  {
    "name" : "Alice",
    "group" : "group1"
  },

  {
    "name" : "Tom",
    "group" : "group2"
  }

];

因此,例如,我希望 Bob 和 Alice 瓷砖位于 1 个组中,而 Tom 位于单独的组中。

我不想使用 SC.ListView 因为每个项目都将是任意复杂的(即,不仅仅是一个名称)。

提前致谢。

Does the SC.Gridview support grouping? If so, can someone give me some pointers how to get started?

I'm trying to build gridview of tiles separated into logical groups. My underlying model is similar to the following:

TestApp.personModel.FIXTURES = [

  {
    "name" : "Bob",
    "group" : "group1"
  },

  {
    "name" : "Alice",
    "group" : "group1"
  },

  {
    "name" : "Tom",
    "group" : "group2"
  }

];

So, for example, I'd like Bob and Alice tiles to be in 1 group and Tom to be a separate group.

I don't want to use the SC.ListView because each item is going to be arbitrarily complex (i.e., not just a name).

Thanks in advance.

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

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

发布评论

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

评论(1

请别遗忘我 2024-11-04 16:39:54

只要您创建一个控制器,其中包含每个组的列表(因此是一个 SC.ArrayController),该控制器包含与每个组相关的 personModel 对象的列表(触发一个查询,该查询将对每个组的结果进行分组),SC. GridView 能够按照您的意愿显示每个组。我建议有一个“ItemView”来定义网格中每个项目的呈现方式。此 ItemView 通过 exampleView 属性与 GridView 链接。

查看 EurekaJ 应用程序的以下代码,了解如何使用 GridView 显示图表列表。

https://github.com /joachimhs/EurekaJ/blob/master/EurekaJ.View/apps/EurekaJView/views/chart/chart_grid.js

As long as you create a controller that has a list of each group (so an SC.ArrayController) that has a list of the personModel objects releated to each group (fire off a query that will group your results per group), the SC.GridView is able to display each group just as you would like. I would recommend to have an "ItemView" that defines how each item in the grid is rendered. This ItemView is linked up with the GridView via the exampleView property.

Have a look at the following code for the EurekaJ application on how the GridView is used to display a list of charts.

https://github.com/joachimhs/EurekaJ/blob/master/EurekaJ.View/apps/EurekaJView/views/chart/chart_grid.js

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