Grid focus problem in ExtJS4

We use ExtJS4 in our application. We have a problem with the focus of the grid. We use grid.getView().focusEl.focus() in ExtJS3. Now it seems that this is not working. What is the replacement for this in ExtJS4.

+4
source share
1 answer

I helped you check the differences in ExtJS3 and ExtJS4, the main changes - focusEl has been removed from the gridView element.

In ExtJS3, focusEl is a binding in a view

 <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 binding does not exist

Decision

This is a small violin test that I created for you. Basically what you need to change is the following:

 grid.getView().el.focus(); 

Instead of getting focusEl (binding), we use the whole element.

Hope this solves your problem.

+6
source

All Articles