Fixed numeric range facet:

- use X icon for facet remove button
- update facet only when user finishes dragging slider bracket

git-svn-id: http://google-refine.googlecode.com/svn/trunk@250 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-03-09 07:01:13 +00:00
parent 311d15f493
commit 977dbdb9ed

View File

@ -6,7 +6,6 @@ function RangeFacet(div, config, options) {
this._from = ("from" in this._config) ? this._config.from : null; this._from = ("from" in this._config) ? this._config.from : null;
this._to = ("to" in this._config) ? this._config.to : null; this._to = ("to" in this._config) ? this._config.to : null;
this._timerID = null;
this._error = false; this._error = false;
this._initializedUI = false; this._initializedUI = false;
} }
@ -99,10 +98,14 @@ RangeFacet.prototype._initializeUI = function() {
self._sliderDiv.slider("values", 1, self._to); self._sliderDiv.slider("values", 1, self._to);
} }
self._setRangeIndicators(); self._setRangeIndicators();
self._scheduleUpdate(); self._updateRest();
}).prependTo(headerDiv); }).prependTo(headerDiv);
var removeButton = $('<a href="javascript:{}"></a>').addClass("facet-choice-link").text("remove").click(function() { var removeButton = $('<img>')
.attr("src", "images/close.png")
.attr("title", "Remove this facet")
.addClass("facet-choice-link")
.click(function() {
self._remove(); self._remove();
}).prependTo(headerDiv); }).prependTo(headerDiv);
@ -129,14 +132,14 @@ RangeFacet.prototype._initializeUI = function() {
self._to = ui.values[1]; self._to = ui.values[1];
} }
self._setRangeIndicators(); self._setRangeIndicators();
self._scheduleUpdate(); self._updateRest();
}; };
var sliderConfig = { var sliderConfig = {
range: "max", range: "max",
min: this._config.min, min: this._config.min,
max: this._config.max, max: this._config.max,
value: 2, value: 2,
slide: onSlide stop: onSlide
}; };
if ("step" in this._config) { if ("step" in this._config) {
sliderConfig.step = this._config.step; sliderConfig.step = this._config.step;
@ -264,16 +267,6 @@ RangeFacet.prototype._remove = function() {
this._data = null; this._data = null;
}; };
RangeFacet.prototype._scheduleUpdate = function() {
if (this._timerID == null) {
var self = this;
this._timerID = window.setTimeout(function() {
self._timerID = null;
self._updateRest();
}, 300);
}
};
RangeFacet.prototype._updateRest = function() { RangeFacet.prototype._updateRest = function() {
Gridworks.update({ engineChanged: true }); Gridworks.update({ engineChanged: true });
}; };