[英]grid focus issue in ExtJS4
We are using ExtJS4 in our application.我们在我们的应用程序中使用 ExtJS4。 We have a problem with grid focus.We are using grid.getView().focusEl.focus()
in ExtJS3.网格焦点有问题。我们在 ExtJS3 中使用grid.getView().focusEl.focus()
。 Now it seems that this is not working.What is the replacement for this one in ExtJS4.现在看来这不起作用。ExtJS4 中这个的替代品是什么。
I have helped you checked on the differences in ExtJS3 and ExtJS4, the major changes is the focusEl has been removed from the gridView element.我已经帮助您检查了 ExtJS3 和 ExtJS4 的差异,主要变化是 focusEl 已从 gridView 元素中删除。
In ExtJS3, focusEl is the anchor link in the view在 ExtJS3 中,focusEl 是视图中的锚链接
<div class="x-grid3-scroller" id="ext-gen10" style="width: 298px; height: 174px; ">
<div class="x-grid3-body" style="width:100px;" id="ext-gen12">
<div class="x-grid3-row x-grid3-row-first x-grid3-row-last" style="width:100px;">
<table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="width:100px;">
<tbody>
<tr><td class="x-grid3-col x-grid3-cell x-grid3-td-0 x-grid3-cell-first " style="width: 100px;" tabindex="0"><div class="x-grid3-cell-inner x-grid3-col-0" unselectable="on">0</div></td></tr>
</tbody>
</table>
</div>
</div>
<a href="#" class="x-grid3-focus" tabindex="-1" id="ext-gen13"></a>
</div>
In ExtJS4, this anchor link doesn't exist在 ExtJS4 中,这个锚链接不存在
Solution解决方案
This is a small fiddle test I have created for you.这是我为您创建的一个小小提琴测试。 Basically what you need to change is as follow:基本上您需要更改的内容如下:
grid.getView().el.focus();
Instead of getting the focusEl (an anchor link), we use the whole element.我们使用整个元素,而不是获取 focusEl(锚链接)。
Hope this solve your problem.希望这能解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.