From 7e0341ce13db05eae6fe1613ee086c8a678bfe3b Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 5 Feb 2009 04:36:08 +0000 Subject: [PATCH] selected-ness follow mouse and key navigation in a uniform fashion. git-svn-id: svn://svn.open-ils.org/ILS/trunk@12072 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/widget/AutoGrid.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index 7f8f5d0c91..441f6fc073 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -15,11 +15,14 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { editOnEnter : false, startup : function() { + + this.selectionMode = 'single'; this.inherited(arguments); this.initAutoEnv(); var existing = (this.structure && this.structure[0].cells[0]) ? this.structure[0].cells[0] : []; var fields = []; + for(var f in this.sortedFieldList) { var field = this.sortedFieldList[f]; if(!field || field.virtual) continue; @@ -30,6 +33,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { if(!entry.get) entry.get = openils.widget.AutoGrid.defaultGetter } + this.setStructure([{cells: [fields]}]); this.setStore(this.buildAutoStore()); if(this.editOnEnter) @@ -38,13 +42,14 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { /* capture keydown and launch edit dialog on enter */ _applyEditOnEnter : function() { + this.onMouseOverRow = function(e) {}; this.onMouseOutRow = function(e) {}; this.onCellFocus = function(cell, rowIndex) { - openils.Util.addCSSClass( - cell.getNode(rowIndex).parentNode, - 'oils-grid-row-selected'); - } + this.selection.deselectAll(); + this.selection.select(this.focus.rowIndex); + }; + dojo.connect(this, 'onKeyDown', function(e) { if(e.keyCode == dojo.keys.ENTER) { -- 2.11.0