【发布时间】:2016-09-07 23:51:06
【问题描述】:
我正在使用 IBM Content Navigator 2.0.3,它使用 DOJO 1.8 进行 GUI 开发。我是 dojo 的新手,我必须增强其中一种形式:向dataGrid 添加一个事件处理程序,以便在选择网格行时启用其中一个按钮。
dataGrid在HTML中描述如下:
<div class="selectedGridContainer" data-dojo-attach-point="_selectedDataGridContainer">
<div class="selectedGrid" data-dojo-attach-point="_selectedDataGrid" ></div>
</div>
而控制表单行为的JS文件只在_selectedDataGrid函数中提到了这个postCreate:
postCreate: function() {
this.inherited(arguments);
this.textDir = has("text-direction");
this.hoverHelpList = [];
domClass.add(this._selectedDataGridContainer, "hasSorting");
this._renderSelectedGrid();
_renderSelectedGrid() 正在执行,其中包含唯一提及:
_renderSelectedGrid: function() {
.......
this._selectedDataGrid.appendChild(this._selectedGrid.domNode);
我尝试在 HTML 中添加一个 data-dojo-attach-event onRowClick: enableRemoveUsersButton 和一个
enableRemoveUsersButton: function(evt){
this.removeUsersButton.set('disabled', true);
},
在 js 文件中。没有帮助。
然后我尝试了:
dojo.connect(myGrid, "onRowclick", function update() {
this.removeUsersButton.set('disabled', true); });
但我无法使用以下方法获取 myGrid 对象:
`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?
谢谢!
【问题讨论】: