我正在使用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
?
答案 0 :(得分:1)
我没有使用过Dojo gridx,但是看一下它的一个基本演示,它在每行<table>
内呈现<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,它会更容易解决。