From 65c43ba6f01997b64ab1d4bebd7b426aeff2f0c6 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 16 May 2016 16:30:27 -0600 Subject: [PATCH] Implement set_filter() & set_filter2() to allow application code to change filter & filter2 values, and have them updated in the client UI --- api/js/etemplate/et2_extension_nextmatch.js | 40 +++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index 92fa166208..dfbb8a7880 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -1796,6 +1796,46 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_ this.set_no_filter(bool,'filter2'); }, + /** + * Directly change filter value, with no server query. + * + * This allows the server app code to change filter value, and have it + * updated in the client UI. + * + * @param {String|number} value + */ + set_filter: function(value) { + var update = this.update_in_progress; + this.update_in_progress = true; + + this.activeFilters.filter = value; + + // Update the header + this.header.setFilters(this.activeFilters); + + this.update_in_progress = update; + }, + + /** + * Directly change filter2 value, with no server query. + * + * This allows the server app code to change filter2 value, and have it + * updated in the client UI. + * + * @param {String|number} value + */ + set_filter2: function(value) { + var update = this.update_in_progress; + this.update_in_progress = true; + + this.activeFilters.filter2 = value; + + // Update the header + this.header.setFilters(this.activeFilters); + + this.update_in_progress = update; + }, + /** * If nextmatch starts disabled, it will need a resize after being shown * to get all the sizing correct. Override the parent to add the resize