-
10 Jun 2011 3:10 PM #1
Howto disable grid focus on click?
Howto disable grid focus on click?
I have a simple grid loaded from a remote store. When a user clicks a cell it calls focus and repositions the browser window to the grid. I do not want this behavior. Grid Panel docs suggest using focusOnToFront which I set to false but it still doesn't do anything. any ideas? Disabling all focus/click events on the grid panel works for me if there's a way to do that.
You can reproduce this only on Chrome, not firefox on the example page.
Open this example, scroll to the top of the page, make your chrome window smaller coming mid way over the grid and then click on a row. The browser scrolls down.. why
http://dev.sencha.com/deploy/ext-4.0.../xml-grid.html
-
13 Jun 2011 9:41 AM #2
-
14 Jun 2011 5:29 AM #3
Howto disable grid focus on click? answer
Howto disable grid focus on click? answer
Not sure if you ever came around solving this. For all
This is a functionality which could potentially build up to a bug/unwanted behaviour...
This can be solve by disabling all listeners on the grid e.g.
Code:itemsGrid.disableEvents(true);
or the specific event (onclick)...
-
14 Jun 2011 11:07 AM #4
I don't see disableEvents() method on the grid panel.. ? thanks for the reply!
-
15 Jun 2011 9:01 AM #5
Yes there is a disableEvents(boolean disable) method
Yes there is a disableEvents(boolean disable) method
Hi Netslayer,
There is:
Note: this would also take away mouse roll-over and roll-off listeners. The instance that I have use this for didn't require this functionality neither.Code:/** * True to disable event processing. * * @param disable true to disable */ public void disableEvents(boolean disable) { disableEvents = disable; }
see http://www.sencha.com/gxtdocs/codese...onent&line=375
let me know how you get on...
-
15 Jun 2011 1:53 PM #6
I'm using Extjs4 so I don't have access to that method. I have tried suspendEvents(false) on the grid and it doesn't help. It's easily reproducible in the example grid in chrome.
-
16 Jun 2011 10:53 AM #7
I can replicate this behavior very simply on a grid in chrome by just calling view focus. The page jumps down to the grid. Any ideas on how to disable this?
Ext.getCmp('myGrid').getView().focus();
-
16 Jun 2011 10:59 AM #8
Found a solution:
Ext.getCmp('myGrid').getView().suspendEvents(false);
It doesn't make sense that a grid view has a focus event that repositions the pages viewport on click.
-
16 Jun 2011 1:45 PM #9
The problem I had with suspendEvents is obviously it broke the load event on the grid which was needed. Wrote a quick function to remove the culprit managed listener "mousedown" that's on the grids view.
I call this with disableGridClick(grid.getView());
Code:function disableGridClick(view) { var managedListeners = view.managedListeners || [], i = 0, len = managedListeners.length; for (; i < len; i++) { if (managedListeners[i].ename == 'mousedown') { view.removeManagedListenerItem(true, managedListeners[i]); } } }
-
25 Jul 2011 8:10 PM #10
For me the problem is more severe. I cannot disable grid events as I need them.
I'm using cellEditing plugin. So when I disable mousedown, it works for non-editable cells. But when I click editable cell, it again calls focus, grid shifts up and js exception is thrown 'event is null'.
Any solution preferrably w/o disabling grid events?
thx
Vaibhav


Reply With Quote