【问题标题】:How to focus second Cell when add a new row in dojo.gridX在 dojo.gridX 中添加新行时如何聚焦第二个单元格
【发布时间】:2015-10-11 21:50:02
【问题描述】:

我正在使用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 中实现此功能?

【问题讨论】:

  • 请人帮忙。

标签: javascript dojo dojox.grid dojo.gridx gridx


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-04
    • 2012-04-07
    • 1970-01-01
    • 2010-09-22
    • 1970-01-01
    • 1970-01-01
    • 2020-06-09
    • 1970-01-01
    相关资源
    最近更新 更多