function TextSearchFacet(div, config, options) { this._div = div; this._config = config; this._options = options; this._setDefaults(); this._timerID = null; this._initializeUI(); } TextSearchFacet.prototype._setDefaults = function() { this._query = null; }; TextSearchFacet.prototype.getJSON = function() { var o = { type: "text", name: this._config.name, columnName: this._config.columnName, mode: this._config.mode, caseSensitive: this._config.caseSensitive, query: this._query }; return o; }; TextSearchFacet.prototype.hasSelection = function() { return this._query != null; }; TextSearchFacet.prototype._initializeUI = function() { var self = this; var container = this._div.empty(); var headerDiv = $('
').addClass("facet-title").appendTo(container); $('').text(this._config.name).appendTo(headerDiv); var removeButton = $('').addClass("facet-choice-link").text("remove").click(function() { self._remove(); }).prependTo(headerDiv); var bodyDiv = $('').addClass("facet-text-body").appendTo(container); var input = $('').appendTo(bodyDiv); input.keypress(function(evt) { self._query = this.value; self._scheduleUpdate(); }); input[0].focus(); }; TextSearchFacet.prototype.updateState = function(data) { }; TextSearchFacet.prototype.render = function() { this._setRangeIndicators(); }; TextSearchFacet.prototype._reset = function() { this._setDefaults(); this._updateRest(); }; TextSearchFacet.prototype._remove = function() { ui.browsingEngine.removeFacet(this); this._div = null; this._config = null; this._options = null; }; TextSearchFacet.prototype._scheduleUpdate = function() { if (this._timerID == null) { var self = this; this._timerID = window.setTimeout(function() { self._timerID = null; self._updateRest(); }, 500); } }; TextSearchFacet.prototype._updateRest = function() { Gridworks.update({ engineChanged: true }); };