dojo datagrid事件附加问题 [英] dojo datagrid event attach issue

查看:161
本文介绍了dojo datagrid事件附加问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用IBM Content Navigator 2.0.3,它使用DOJO 1.8进行GUI开发。我在dojo中是新的,我必须增强一种形式:在 dataGrid 中添加一个事件处理程序,所以当选择一个网格的一个按钮成为

I am working with IBM Content Navigator 2.0.3, that uses DOJO 1.8 for the GUI development. I am new in dojo, and I have to enhance one of the forms: add an event handler to the dataGrid so when the row of the grid is selected one of the buttons become enabled.

dataGrid 在HTML中描述如下:

dataGrid described in HTML as follows:

<div class="selectedGridContainer" data-dojo-attach-point="_selectedDataGridContainer">                     
    <div class="selectedGrid" data-dojo-attach-point="_selectedDataGrid" ></div>
</div>

并且控制表单行为的JS文件提到这个 _selectedDataGrid 只有一次,在 postCreate 函数中:

And the JS file that controls the form behavior mentioned this _selectedDataGrid only once, in the postCreate function:

postCreate: function() {
    this.inherited(arguments);
    this.textDir = has("text-direction");
    this.hoverHelpList = [];
    domClass.add(this._selectedDataGridContainer, "hasSorting");
    this._renderSelectedGrid();

_renderSelectedGrid()正在执行,只包含以下内容:

_renderSelectedGrid() is being executed, which contains the only mention:

_renderSelectedGrid: function() {
    .......
    this._selectedDataGrid.appendChild(this._selectedGrid.domNode); 

我尝试添加一个数据dojo-attach-event onRowClick :在HTML中的enableRemoveUsersButton

I've tried to add an data-dojo-attach-event onRowClick: enableRemoveUsersButton in the HTML and a

enableRemoveUsersButton: function(evt){
    this.removeUsersButton.set('disabled', true);
},

在js文件中。没有帮助。

in js file. Didn't help.

然后我试过:

dojo.connect(myGrid, "onRowclick", function update() {
    this.removeUsersButton.set('disabled', true); });

但我无法获取 myGrid 对象使用:

but I couldn't acquire myGrid object using:

`var myGrid  = dojo.byId("_selectedDataGrid");`

任何人都可以告诉我如何获取网格对象和/或向此网格添加事件处理程序,当选择网格的行时触发该事件处理程序

Can anyone tell me how to acquire the grid object and/or add an event handler to this grid, that fires when the row of the grid is selected?

谢谢!

推荐答案

我可以看到节点_selectedDataGrid只是一个Div标签。而您的dataGrid小部件可能是this._selectedGrid,因此您应该在该小部件上添加不是容器节点的事件。

From what you have share, I can see that the node "_selectedDataGrid" is just a Div tag. and your dataGrid widget may be "this._selectedGrid" so you should be add the event on that widget not the container node.

还有dijit.byId来获取dijits / widgets的实例。并且dojo.byId用于搜索dom节点。

Also there is dijit.byId to get the instance of dijits/widgets. and dojo.byId is used to search of dom nodes.

希望这是有帮助的。

这篇关于dojo datagrid事件附加问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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