From 88fb1a63a29f657fe116caf546b366700c709463 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Sun, 21 Nov 2010 12:09:02 -0700 Subject: [PATCH] Fix selecting all rows in a viewport --- imp/js/dimpbase.js | 4 ++-- imp/js/viewport.js | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/imp/js/dimpbase.js b/imp/js/dimpbase.js index 6d8332915..99ee0c8ff 100644 --- a/imp/js/dimpbase.js +++ b/imp/js/dimpbase.js @@ -56,7 +56,7 @@ var DimpBase = { if (selcount) { if (!sel || selcount != 1) { bounds = [ rownum, this.pivotrow ]; - this.viewport.select($A($R(bounds.min(), bounds.max())), { range: true }); + this.viewport.select($A($R(bounds.min(), bounds.max()))); } return; } @@ -76,7 +76,7 @@ var DimpBase = { selectAll: function() { - this.viewport.select(this.viewport.getAllRows(), { range: true }); + this.viewport.select($A($R(1, this.viewport.getMetaData('total_rows')))); }, isSelected: function(format, data) diff --git a/imp/js/viewport.js b/imp/js/viewport.js index d33bfde58..6622fc6be 100644 --- a/imp/js/viewport.js +++ b/imp/js/viewport.js @@ -1281,7 +1281,7 @@ var ViewPort = Class.create({ // vs = (ViewPort_Selection | array) A ViewPort_Selection object -or- if // opts.range is set, an array of row numbers. - // opts = (object) TODO [add, range, search] + // opts = (object) [add, search] select: function(vs, opts) { opts = opts || {}; @@ -1289,26 +1289,26 @@ var ViewPort = Class.create({ var b = this._getBuffer(), sel, slice; + if (Object.isArray(vs)) { + slice = this.createSelection('rownum', vs); + if (vs.size() != slice.size()) { + this.opts.container.fire('ViewPort:fetch', this.view); + return this._ajaxRequest({ rangeslice: 1, slice: vs.min() + ':' + vs.size() }); + } + vs = slice; + } + if (opts.search) { return this._fetchBuffer({ callback: function(r) { if (r.rownum) { - this.select(this.createSelection('rownum', [ r.rownum ]), { add: opts.add, range: opts.range }); + this.select(this.createSelection('rownum', [ r.rownum ]), { add: opts.add }); } }.bind(this), search: opts.search }); } - if (opts.range) { - slice = this.createSelection('rownum', vs); - if (vs.size() != slice.size()) { - this.opts.container.fire('ViewPort:fetch', this.view); - return this._ajaxRequest({ rangeslice: 1, slice: vs.min() + ':' + vs.size() }); - } - vs = slice; - } - if (!opts.add) { sel = this.getSelected(); b.deselect(sel, true); -- 2.11.0