7

dojo.gridx用来显示我的价值观。有时用户可以创建一个新行。这样我在单击 newRow 按钮时添加了一个新按钮,将调用 onclick 方法。

在该方法中创建了新的行代码。我的代码如下。

添加行:

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

4

1 回答 1

1

我没有使用过 Dojo gridx,但是查看它的一个基本演示,它为每一行渲染一个<table>inside <div>。使用上面示例中的 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,它会更容易解决。

于 2015-09-29T16:56:26.977 回答