From ee1a3d58cf2b586d0efcf54be4f48a56f6a34b0b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 29 Mar 2012 09:12:01 -0400 Subject: [PATCH] GridColumPicker hides sort selection for non-sortable fields Query the grid to determine when a column is sortable. When not, simply hide the sort priority selector. Signed-off-by: Bill Erickson --- .../web/js/dojo/openils/widget/GridColumnPicker.js | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js b/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js index add99ade7f..fe226942cd 100644 --- a/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js +++ b/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js @@ -165,7 +165,7 @@ if(!dojo._hasResource["openils.widget.GridColumnPicker"]) { ipt2.setAttribute('type', 'checkbox'); ipt2.setAttribute('name', 'width'); - ipt3 = document.createElement('input'); + ipt3 = document.createElement('div'); if (cell.nonSelectable) { ipt.setAttribute('checked', 'checked'); @@ -196,14 +196,17 @@ if(!dojo._hasResource["openils.widget.GridColumnPicker"]) { else this.dialogTable.appendChild(tr); - // this must be added after its parent node is inserted into the DOM. - var ns = new dijit.form.NumberSpinner( - { constraints : {places : 0}, - value : cell._sort || 0, - style : 'width:4em', - name : 'sort' - }, ipt3 - ); + if ( this.grid.canSort(i+1) ) { // column index is 1-based + + // must be added after its parent node is inserted into the DOM. + var ns = new dijit.form.NumberSpinner( + { constraints : {places : 0}, + value : cell._sort || 0, + style : 'width:4em', + name : 'sort', + }, ipt3 + ); + } } }, @@ -221,7 +224,7 @@ if(!dojo._hasResource["openils.widget.GridColumnPicker"]) { var sort = dojo.query('[name=sort]', row)[0]; var cell = this.cells[i]; // index should match dialog - if (cell._sort != sort.value) { + if (sort && cell._sort != sort.value) { sortUpdated = true; cell._sort = sort.value; } -- 2.11.0