如何将组合框聚焦在网格面板内?
我到处搜索都找不到这个,而且我所有的方法都不起作用。
基本上,这就是我所拥有的。我有一个包含许多行的网格面板(使用ExtJS 4
)。每行都有一个包含组合框的列。
现在,我有一个“添加”按钮,单击该按钮后,会添加一个新模型并将其插入到商店中。效果很好。但是,用户必须使用鼠标并单击新插入行内的组合框才能开始键入。我们的应用程序主要集中在键盘上,不鼓励使用鼠标(作为数据输入应用程序)。
我可以使用 a: 选择第一行:
grid.view.getSelectionModel().select(newRow);
但是,里面的组合框没有聚焦。
我该如何解决这个问题?
谢谢。
编辑
我尝试在此处发布我的源代码,但它总是超时,所以这里是我的代码的要点
:
https://gist.github.com/1089782
谢谢
I've searched high and low and can't find this and all of my methods do not work.
Basically, here is what I have. I have a Grid Panel (using ExtJS 4
) that contains many rows. Each row has a column that contains a combo box.
Now, I have a "Add" button that when clicked, adds a new model and inserts it into the store. Works great. However, the user has to use the mouse and click the combo box inside the newly inserted row to begin typing. Our app is heavily focused on the keyboard and the mouse is discouraged (being a data entry app).
I am able to select the first row with a:
grid.view.getSelectionModel().select(newRow);
However, the combo box inside isn't focused.
How can I solve this?
Thanks.
EDIT
I've tried to post my source code here on SO but it keeps timing out so here is a gist
of my code:
https://gist.github.com/1089782
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有检查它的组合框,但它适用于文本字段:
首先将 id 分配给 celledit 插件:
插件:[
Ext.create('Ext.grid.plugin.CellEditing', {
编辑点击次数:1,
id: '我的插件'
})
]
然后,假设
newRow
是新插入的模型,并且带有组合框的列的索引 == 1,您可以使用:grid.getPlugin('my_plugin').startEditByPosition({row: newRow.index, column: 1});
I didn't check it for for comboboxes but it worked for textfields:
Firstly assign id to celledit plugin:
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
id: 'my_plugin'
})
]
And then, provided
newRow
is newly inserted model and column with comboboxes has index == 1, you can use:grid.getPlugin('my_plugin').startEditByPosition({row: newRow.index, column: 1});