ExtJS树多个模型(嵌套)
我有一棵异步加载的树。我有两个模型,经理和用户。
管理员可以是父节点,也可以是叶子节点,但用户只能是叶子节点。因此,一个 Manager 可以有任意数量的上级或下级 Manager,但 I User 只能是 Manager 的子级。
我已经为 User 和 Manager 模型设置了代理,并将 Manager 设置为 TreeStore 的模型参数。我尝试使用hasMany和belongsTo来描述关系,希望每次展开节点时,都会发送针对用户和管理者的获取。它不起作用。我只得到经理,而不是用户。
有人对处理此类关系有什么建议吗?
I have a tree that is loading asynchronously. I have two models, Manager and User.
Managers can be parent nodes or leaf nodes, but Users can only be leaf nodes. So, a Manager can have any number of Managers above or below him, but I User can only be the child of a Manager.
I have set up proxies for the User and Manager models and set Manager as the TreeStore's Model parameter. I tried using hasMany and belongsTo to describe the relations, hoping that every time I expand a node, a get for Users and for Managers is sent. It isn't working. I'm only getting Managers, not Users.
Anyone have any tips for working with these kinds of relationships?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建新模型“Employee”,该模型将具有属性 (
IsUser
) 并加载到经理和用户 IE 列表中:用于填充的 SQL 查询应如下所示:
Create new model 'Employee' that will have a property (
IsUser
) and load into list both managers and users IE:And SQL query for populating should look like this: