From ef48c844c7927ea07a65ad281cd673c17f363810 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Wed, 14 Mar 2012 02:52:49 -0400 Subject: [PATCH] add Line# column to autogrid hidden by default, but we need to make it show up in autogrid's column picker Signed-off-by: Jason Etheridge Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/web/css/skin/default.css | 4 ++++ Open-ILS/web/js/dojo/openils/widget/AutoGrid.js | 27 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/Open-ILS/web/css/skin/default.css b/Open-ILS/web/css/skin/default.css index 1973b4987b..209832950a 100644 --- a/Open-ILS/web/css/skin/default.css +++ b/Open-ILS/web/css/skin/default.css @@ -75,6 +75,10 @@ table { border-collapse: collapse; } .dijitTooltipTable td {padding: 3px;} /* custom class for handling dialog tables */ /* ----------------------------------------------------------------- */ +.autoGridLineNumber { + background-color: -moz-dialog; + font-weight: bold; +} .oils-fm-edit-pane { margin: 5px; } .oils-fm-edit-pane td { padding: 5px; } diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index 921f97766d..ba789e19a5 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -25,9 +25,22 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { suppressEditFields : null, suppressFilterFields : null, hideSelector : false, + hideLineNumber : false, selectorWidth : '1.5', + lineNumberWidth : '1.5', showColumnPicker : false, columnPickerPrefix : null, + onStyleRow : function(row) { + // FIXME: this really feels kludgy (sensitive to how dojo constructs the HTML), and is + // probably not idiomatic dojo + if (!this.hideLineNumber) { + if (this.hideSelector) { + dojo.addClass(row.node.firstChild.firstChild.firstChild.childNodes[0],'autoGridLineNumber'); + } else { + dojo.addClass(row.node.firstChild.firstChild.firstChild.childNodes[1],'autoGridLineNumber'); + } + } + }, displayLimit : 15, displayOffset : 0, requiredFields : null, @@ -156,6 +169,10 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { canSort : function(rowIdx) { if(rowIdx == 1 && !this.hideSelector) return false; + if(this.hideSelector && rowIdx == 1 && !this.hideLineNumber) + return false; + if(!this.hideSelector && rowIdx == 2 && !this.hideLineNumber) + return false; return true; }, @@ -189,6 +206,16 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { }); } + if(!this.hideLineNumber) { + // insert the line number column + pushEntry({ + field : '+lineno', + get : function(rowIdx, item) { if(item) return 1 + rowIdx; }, + width : this.lineNumberWidth, + name : '#', + nonSelectable : false + }); + } if(!this.fieldOrder) { /* no order defined, start with any explicit grid fields */ -- 2.11.0