Opened 11 years ago
Closed 8 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)
Change History (9)
Changed 11 years ago by
comment:1 Changed 11 years ago by
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 11 years ago by
Component: | General → DojoX Grid |
---|---|
Owner: | changed from anonymous to bryanforbes |
comment:3 Changed 11 years ago by
Owner: | changed from bryanforbes to Bryan Forbes |
---|
comment:4 Changed 10 years ago by
I've attached a patch that appears to work for us. I would welcome any feedback.
Thanks, Sam
comment:6 Changed 8 years ago by
comment:7 Changed 8 years ago by
Resolution: | → patchwelcome |
---|---|
Status: | new → closed |
simple example file based on DataGrid? example from dojocampus.org