diff --git a/dist/GridSearch.mpk b/dist/GridSearch.mpk index 94d3492..102cd86 100644 Binary files a/dist/GridSearch.mpk and b/dist/GridSearch.mpk differ diff --git a/package.json b/package.json index 301e642..f20b7ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "GridSearch", - "version": "3.1.0", + "version": "3.1.1", "description": "Search Mendix Grids and Lists using a number of search widgets.", "license": "Apache 2", "author": "Eric Tieniber", diff --git a/src/GridSearch/widget/AnySearch.js b/src/GridSearch/widget/AnySearch.js index 84df9f9..9444287 100644 --- a/src/GridSearch/widget/AnySearch.js +++ b/src/GridSearch/widget/AnySearch.js @@ -117,13 +117,15 @@ define([ this.subscribe({ guid: this._contextObj.getGuid(), attr: this.xpathAttribute, - callback: this._fireSearch + callback: () => { + this._fireSearch(); + } }); - this.subscribe({ + /*this.subscribe({ guid: this._contextObj.getGuid(), callback: this._fireSearch - }); - this._fireSearch(); + });*/ + //this._fireSearch(); }, _isEmptyObject: function (obj) { diff --git a/src/GridSearch/widget/Core.js b/src/GridSearch/widget/Core.js index 4dc14f3..7d7e716 100644 --- a/src/GridSearch/widget/Core.js +++ b/src/GridSearch/widget/Core.js @@ -153,26 +153,28 @@ define([ } if (datasource._constraints !== constraints) { - datasource.setConstraints(constraints); - //if the grid is set to wait for search, ensure we set the "_searchFilled" flag - if (grid.config && grid.config.gridpresentation && grid.config.gridpresentation.waitforsearch) { - if (constraints) { - grid._searchFilled = true; - } else { - //grid._searchFilled = false; //grid doesn't refresh or empty if you do this - datasource.setConstraints("[1=0]"); + if (grid.__customWidgetDataSourceHelper) { + //Using ListViewControls + grid.__customWidgetDataSourceHelper.store.constraints._none["GridSearch"] = constraints; + } else { + //No ListViewControls + datasource.setConstraints(constraints); + //if the grid is set to wait for search, ensure we set the "_searchFilled" flag + if (grid.config && grid.config.gridpresentation && grid.config.gridpresentation.waitforsearch) { + if (constraints) { + grid._searchFilled = true; + } else { + //grid._searchFilled = false; //grid doesn't refresh or empty if you do this + datasource.setConstraints("[1=0]"); + } + } } - } - self.onSearchChanged(); - self._reloadOneGrid(grid); - console.log("set constraints for grid: " + grid.id) + self.onSearchChanged(); + self._reloadOneGrid(grid); + console.log("set constraints for grid: " + grid.id) } else { console.log("did not set constraints for grid as they did not change: " + grid.id) } - //duct tape and glue connection to the List View Controls widget - if (grid.__customWidgetDataSourceHelper) { - grid.__customWidgetDataSourceHelper.store.constraints._none["GridSearch"] = constraints; - } }, _getSearchConstraintAllSearchBoxes: function () { var searchWidgets = this._searchWidgets[this.targetGridClass]; @@ -189,7 +191,6 @@ define([ for (var i = 0; i < searchWidgets.length; i++) { searchWidgets[i]._clear(); } - this._fireSearch(); }, _reloadGrid: function () { @@ -202,7 +203,7 @@ define([ if (grid.__customWidgetDataSourceHelper) { var dsh = grid.__customWidgetDataSourceHelper dsh.requiresUpdate = true; - dsh.iterativeUpdateDataSource(); + dsh.updateDataSource(function() {}); } else { this._startProgressBarDelay(); if (grid.reload) { diff --git a/src/package.xml b/src/package.xml index a6db81b..af375b1 100644 --- a/src/package.xml +++ b/src/package.xml @@ -1,6 +1,6 @@ - + diff --git a/test/widgets/GridSearch.mpk b/test/widgets/GridSearch.mpk index 94d3492..102cd86 100644 Binary files a/test/widgets/GridSearch.mpk and b/test/widgets/GridSearch.mpk differ