【发布时间】:2014-06-04 04:36:18
【问题描述】:
我有一个作业,在学习道场小部件时,我被困在一个部分。
首先,我创建了包含布局(左、中、底部窗格)的主小部件。 在左窗格中,我附加了树小部件(员工姓名在树中列出)。 在中心窗格中,我根据要求(员工详细信息)附加了一个自定义小部件。 底部窗格中的数据网格相同,根据要求自定义小部件(网格中的其他员工详细信息)。
我计划编写代码,以便我可以单击左侧窗格的树小部件的子节点并将员工的 ID 传递给其他两个小部件的属性(中心和底部窗格上的小部件)并查看相应的按点击显示员工详细信息。
这就是我卡住的地方。我无法在小部件上传递值,因为它们是单独的实体。
树小部件(在左侧窗格中):
var tree = new dijit.Tree({model: tree_model, onClick: function(e){
console.log(e.id[0]); /*clicking on the tree nodes, i'm able to see the user id of the current selection*/
});
底部网格(底部窗格中的自定义小部件):
var bottomGridWid = new custom.bottomGrid({default_user_id: userid});
//passing different userid to the widget will automatically query the grid and display the result
【问题讨论】:
标签: javascript dojo widget