[qooxdoo-bugs] [Bug 806] New: Table with no rows retains focus indicator
Brought to you by:
ecker,
martinwittemann
From: <bug...@qo...> - 2008-03-19 10:04:58
|
http://bugzilla.qooxdoo.org/show_bug.cgi?id=806 Summary: Table with no rows retains focus indicator Product: framework Version: 0.7.3 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P3 Component: ui-table AssignedTo: no...@qo... ReportedBy: no...@ya... QAContact: qoo...@li... Table whose rows were deleted can retain focus indicator which is not eliminable. To see the problem, run the following code, then click on the table’s pane, press “Down” key and after that “Up” key. You will see focus indicator. Code snippet: var nextId = 0; var createRandomRows = function(rowCount) { var rowData = []; var now = new Date().getTime(); var dateRange = 400 * 24 * 60 * 60 * 1000; // 400 days for (var row = 0; row < rowCount; row++) { var date = new Date(now + Math.random() * dateRange - dateRange / 2); rowData.push([ nextId++, Math.random() * 10000, date, (Math.random() > 0.5) ]); } return rowData; }; var nRowQty = 10; var rowData = createRandomRows(nRowQty); var tableModel = new qx.ui.table.model.Simple(); tableModel.setColumns([ "ID", "A number", "A date", "Boolean test" ]); tableModel.setData(rowData); var table = new qx.ui.table.Table(tableModel); table.set({ left:10, top:10, width:500, height:300, border:"inset-thin" }); table.setFocusedCell(1, 1, false); tableModel.removeRows(0, nRowQty); table.addToDocument(); A possible way to avoid this problem is to apply the following patch to Table.moveFocusedCell: qx.Class.patch(qx.ui.table.Table, qx.Mixin.define("lle5ui.patch.qx.ui.table.Table", { members : { moveFocusedCell : function(deltaX, deltaY) { var col = this._focusedCol; var row = this._focusedRow; if (deltaX != 0) { var columnModel = this.getTableColumnModel(); var x = columnModel.getVisibleX(col); var colCount = columnModel.getVisibleColumnCount(); x = qx.lang.Number.limit(x + deltaX, 0, colCount - 1); col = columnModel.getVisibleColumnAtX(x); } if (deltaY != 0) { var tableModel = this.getTableModel(); if (row >= 0 || deltaY > 0) { row = qx.lang.Number.limit(row + deltaY, 0, tableModel.getRowCount() - 1); } } this.setFocusedCell(col, row, true); } } }) ); By the way, is there any way to defocus (remove focus from) a previously focused cell? Best regards, Denis -- Configure bugmail: http://bugzilla.qooxdoo.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug, or are watching the QA contact. |