如何在dojo.gridX中添加新行时将焦点聚焦于第二个单元格

7

我正在使用 dojo.gridx 来显示我的数值。有时用户可以创建新的行。因此,我添加了一个新的按钮,当点击 "newRow" 按钮时,将调用 onclick 方法。

在该方法中,已编写了创建新行的代码。我的代码如下所示。

addRow:

function() {
    var that = this;
    var gridIdLocal = dijit.byId('GridId');

    that.lastIndex+=1;  ( last index count I get externally)    
    var newRow = {
        Id : '',
        ClassDES:'',
        createdDate: that.getTodayDate(),
        activatedDate:that.getTodayDate(),
        deactivedDate:'',
        activeStatus:'Y',
        id : lastIndex
    };
    gridIdLocal.store.newItem(newRow);
    gridIdLocal.store.save();            
}, 

通过这段代码,我能够创建一个新的行,但是我想让我的鼠标光标指向新添加的行的第二列(ClassDES)。
dojo.gridx 中,我该如何实现这个功能?


请有人帮忙。 - KSK
1个回答

1
我没有使用过Dojo gridx,但是看了一下它的基本演示之一,它在每一行中都渲染了一个,而在
中进行渲染。使用上面你的示例中的newRow对象,你可以使用jquery来实现类似以下的操作。
function() {
    var that = this;
    var gridIdLocal = dijit.byId('GridId');

    that.lastIndex+=1;  ( last index count I get externally)    
    var newRow = {
        Id : '',
        ClassDES:'',
        createdDate: that.getTodayDate(),
        activatedDate:that.getTodayDate(),
        deactivedDate:'',
        activeStatus:'Y',
        id : lastIndex
    };
    gridIdLocal.store.newItem(newRow);
    gridIdLocal.store.save();  

    $(newRow).find("td")[1].children("input").focus();
}, 

如果您能发布一个可用的jsfiddle,那么解决问题会更容易。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接