PDA

View Full Version : Refresh grid without loosing focus elsewhere



stephenliberty
4 Mar 2010, 2:45 AM
Hey All,

I have a few panels that are always open in my application. One of them contains a grid that is full of project updates. I made a 'task' that runs every minute that causes the grid to reload itself. However, this causes the focus to be lost elsewhere, so if I'm in the middle of typing an update and the grid refreshes, the box that I am working in looses its focus and I have to click back into it [as you can imagine, annoying at best]. Is there any way to prevent focus from going to the grid panel every time it reloads?

Thanks,
Stephen

Shub
10 Mar 2010, 1:35 AM
I would also like to know the answer to this!

Have you perhaps found a solution?

stephenliberty
10 Mar 2010, 5:30 AM
Unfortunately I haven't - there are so many other things that I need to finish up with this project that I haven't gotten the chance to sit down and try and fix this bug. The biggest problem is that I (think I) can't just programmatically set the focus back to a particular window or field, as I have no idea what the user might be doing during that refresh..

steffenk
10 Mar 2010, 6:16 AM
Imho it's a bad idea to reload the grid every minute, it's far from user friendly. You may poll and look for data change, but use a button that is highlighted if data changed, force user to press that button.

stephenliberty
10 Mar 2010, 6:57 AM
In this case the client wants as little need for the user to click buttons as possible - this is just a changelog of sorts, showing all of the changes/additions/updates to a project and it's tasks, files, notes, etc. - and there are multiple users on a system capable of making those changes/additions/updates. Think of it almost like a chat window - forcing a user to hit a button every time (s)he wants to see what's going on wouldn't make a whole lot of sense.

Mike Robinson
10 Mar 2010, 7:16 AM
The problem might be that, when you modify the contents of the DOM, the browser's going to very likely lose focus because it has repainted the screen. If you make modifications that do not involve the DOM itself, this doesn't happen.

Browsers do it differently. Different versions of the same browser do it differently.

For instance, "dot-net" gets away with a lot of things by virtue of having ActiveX controls ... which are separate beasts unto themselves and not part of the DOM. The browser provides the container-space for a grid and maybe the data-transport channel but it does not directly control what the grid is doing within its square box of real-estate. In addition, the vendor of dot-net owns the browser implementation ... the only browser that really matters to dot-net.

stephenliberty
25 Mar 2010, 2:23 PM
Well, fixed it. This was a stupid thing on my part. I had added event listeners to the Ext.Ajax so that when something was going on, the user would see a little tiny box pop up in the bottom right part of the screen. Well, that box popping up would steal the focus from whatever field was currently active. The grid reload now works normally. Anyway, thanks everyone for their input.