SproutCore嵌套ListView(SC.ListView)

时间:2012-03-21 10:19:30

标签: javascript sproutcore sproutcore-views

我正在尝试按部门在SproutCore应用中显示联系人列表,并尝试将SC.ListView嵌套在另一个SC.ListView内无效。

我可以use SC.GridView to assist,但是,嵌套的'list'需要在第一个列表的上下文中。如果这可以像JQueryUI的手风琴小部件一样实现,那就更好了!

任何建议都将不胜感激!

谢谢,M。

1 个答案:

答案 0 :(得分:1)

无论你做什么,都不要在另一个列表的项目中嵌套列表。表现会非常糟糕。

有很多选项

1)编写自己的自定义视图。如果你想要精美的动画,这是最简单的选择。

2)使用带有ListView的TreeController,该列表将允许打开相应的项目以显示子项。您将树控制器声明为

App.listController = SC.TreeController.create({
  treeItemIsExpandedKey: "expanded", // the key that 'opens' the item
  treeItemChildrenKey: 'your-children' // the key on an item that contains an array of child items
});
相关问题