如何配置SmartGWT TreeGrid使用不同类型的对象? [英] How can I configure SmartGWT TreeGrid to use different types of objects?

查看:130
本文介绍了如何配置SmartGWT TreeGrid使用不同类型的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个用例:

  1. 我得到了我所有的客户.
  2. 对于每个Cutomer,我想获取他的收据.
  3. 对于每个收据,我要获取所有ShoppingItems.

从示例中,我可以看到如果我具有相同类型的对象层次结构,TreeGrid的工作方式,但是我不知道如何使用用例. 当然,如果有更好的组件来显示这种数据/连接,那也将很好:)

From the examples I can see how TreeGrid works if I had a hierarchy of objects of the same type, but I don't know how this would work with my usecase. Of course, if there's a better component to show this kind of data/connections, that would be good too :)

推荐答案

您可以在父代"模式下使用Tree(TreeGrid背后的模型). 从服务器接收的数据中构建Tree时 您可以向每个节点添加属性,以表示该节点为 Customer 类型,该节点以Customer1为父级,并且为 Receipt 类型.另一个节点将是具有Receipt1作为父节点并且类型为 ShoppingItems 的节点. 从服务器接收的数据构建Tree时 您可以在同时设置type属性的同时,设置节点的图标以反映元素的类型. 由您决定是否将此类节点设置为文件夹(例如,Customers,Receipt将是文件夹,而ShoppingItems不会,并且仅是叶子). 希望它可以帮助

You can use the Tree (the model behind the TreeGrid) in Parent mode. When you build you Tree from the data you receive from the server You can add attribute to each node saying this node is of Customer type, this one has Customer1 as a parent and is of Receipt type. Another will be node with Receipt1 as parent and with ShoppingItems type. When you build you Tree from the data you receive from the server you can in the same time you are setting the type attribute set the icon of the node to reflect the type of your element. Up to you to set such node as folder or not (for example Customers, Receipt will be folders but ShoppingItems not and will be just a leaf). Hope It could help

这篇关于如何配置SmartGWT TreeGrid使用不同类型的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆