我有一个 Dojo Datagrid,其中一列由格式化程序函数呈现为文本框。当我单击呈现的文本框输入一些值时,光标出现在文本框中并且焦点立即丢失(即,光标消失 - 键入不会产生任何内容)。我必须再次单击文本框以设置焦点 - 只有这样我才能输入值。
有没有办法将焦点设置在第一次点击本身上?
这是代码:
<table dojoType="dojox.grid.DataGrid" store="selectedItemsStore" class="resultsGridClass" jsid="selecteditems">
<thead>
<tr>
<th field="field1" formatter="renderTextBox" width="20%">Field 1</th>
</tr>
</thead>
</table>
这是格式化程序功能:
function renderTextBox(value, rowIndex) {
var htmlString = "<input type='text' name= 'exp' />";
return htmlString;
}