Opened 10 years ago

Closed 7 years ago

#10926 closed defect (patchwelcome)

DataGrid Header taking focus from other elements when refreshed

Reported by: leelofgren Owned by: Bryan Forbes
Priority: high Milestone: tbd
Component: DojoX Grid Version: 1.4.1
Keywords: datagrid head header sort focus refocus setquery _refresh _colheadfocusIdx _colheadnode Cc:
Blocked By: Blocking:

Description

If a header column in dojox.grid.DataGrid? had focus before leaving the grid for another element, then that other element triggered a refresh of the DataGrid?, the DataGrid? will pull focus back. Environment: dojo 1.4.1, firefox 3.6.2 on Windows 7. Suspected cause: DataGrid?.focus._colHeadFocusIdx and DataGrid?.focus._colHeadNode are used to return focus to a head cell when columns are destroyed and re-created. the DataGrid? onBlur does not clear these variables so a refresh of the grid causes it to think that it was caused by the header and mistakenly returns focus. Workaround: If the grid doesn't have focus, set [DataGridObject?].focus._colHeadFocusIdx=null and [DataGridObject?].focus._colHeadNode=null before refreshing the grid. What I was doing: I wrote a web page where I have a search textbox that filters the DataGrid? through [DataGridObject?].setQuery() as letters are typed. If I sort a column before typing letters into my search box, the text box it looses focus to the grid header.

Attachments (2)

a.html (2.9 KB) - added by leelofgren 10 years ago.
simple example file based on DataGrid? example from dojocampus.org
10926.patch (501 bytes) - added by Sam Reynolds 9 years ago.
Proposed fix for problem

Download all attachments as: .zip

Change History (9)

Changed 10 years ago by leelofgren

Attachment: a.html added

simple example file based on DataGrid? example from dojocampus.org

comment:1 Changed 10 years ago by leelofgren

In sample page: If prior focus was not on a header row, you can type multiple letters into text box. Click any header row to sort, now you can only type 1 character before focus shifts back to header cell. Add grid4.focus._colHeadFocusIdx=null;grid4.focus._colHeadNode=null; to the refresh_grid function before the grid4.setQuery() and it will now work correctly.

comment:2 Changed 9 years ago by James Burke

Component: GeneralDojoX Grid
Owner: changed from anonymous to bryanforbes

comment:3 Changed 9 years ago by bill

Owner: changed from bryanforbes to Bryan Forbes

Changed 9 years ago by Sam Reynolds

Attachment: 10926.patch added

Proposed fix for problem

comment:4 Changed 9 years ago by Sam Reynolds

I've attached a patch that appears to work for us. I would welcome any feedback.

Thanks, Sam

comment:5 Changed 8 years ago by fabioginzel

+1

comment:6 Changed 7 years ago by bill

DojoX Grid and EnhancedGrid are deprecated in favor of dgrid and gridx.

You should upgrade your code to use one of those two grids.

We will consider patches to the old DojoX Grid code though.

comment:7 Changed 7 years ago by bill

Resolution: patchwelcome
Status: newclosed
Note: See TracTickets for help on using tickets.