diff --git a/modules/backend/widgets/Table.php b/modules/backend/widgets/Table.php index e79fc7376..669d7327e 100644 --- a/modules/backend/widgets/Table.php +++ b/modules/backend/widgets/Table.php @@ -121,6 +121,7 @@ class Table extends WidgetBase $this->vars['recordsPerPage'] = $this->getConfig('recordsPerPage', false) ?: 'false'; $this->vars['postbackHandlerName'] = $this->getConfig('postbackHandlerName', 'onSave'); + $this->vars['searching'] = $this->getConfig('searching', true); $this->vars['adding'] = $this->getConfig('adding', true); $this->vars['deleting'] = $this->getConfig('deleting', true); $this->vars['toolbar'] = $this->getConfig('toolbar', true); diff --git a/modules/backend/widgets/table/assets/js/build-min.js b/modules/backend/widgets/table/assets/js/build-min.js index 9777bd728..c952a6c34 100644 --- a/modules/backend/widgets/table/assets/js/build-min.js +++ b/modules/backend/widgets/table/assets/js/build-min.js @@ -569,8 +569,9 @@ this.searchInput=$('.table-search-input',this.searchForm).get(0)}} Search.prototype.getQuery=function(){return $.trim(this.activeQuery)} Search.prototype.hasQuery=function(){return this.searchEnabled()&&$.trim(this.activeQuery).length>0} Search.prototype.searchEnabled=function(){return this.tableObj.options.searching} -Search.prototype.performSearch=function(query,onSuccess){this.activeQuery=query -this.tableObj.updateDataTable(onSuccess)} +Search.prototype.performSearch=function(query,onSuccess){var isDirty=this.activeQuery!=query +this.activeQuery=query +if(isDirty){this.tableObj.updateDataTable(onSuccess)}} Search.prototype.onKeydown=function(ev){if(ev.keyCode==9){this.onClick(ev) return} if(!this.isActive){return} diff --git a/modules/backend/widgets/table/assets/js/table.helper.search.js b/modules/backend/widgets/table/assets/js/table.helper.search.js index 0f3baa130..16501a24b 100644 --- a/modules/backend/widgets/table/assets/js/table.helper.search.js +++ b/modules/backend/widgets/table/assets/js/table.helper.search.js @@ -74,9 +74,13 @@ } Search.prototype.performSearch = function(query, onSuccess) { + var isDirty = this.activeQuery != query + this.activeQuery = query - this.tableObj.updateDataTable(onSuccess) + if (isDirty) { + this.tableObj.updateDataTable(onSuccess) + } } // EVENT HANDLERS diff --git a/modules/backend/widgets/table/partials/_table.htm b/modules/backend/widgets/table/partials/_table.htm index 7d0572922..8d46c5b40 100644 --- a/modules/backend/widgets/table/partials/_table.htm +++ b/modules/backend/widgets/table/partials/_table.htm @@ -8,6 +8,7 @@ data-field-name="fieldName) ?>" data-postback-handler-name="" data-adding="" + data-searching="" data-deleting="" data-toolbar="" data-height="" @@ -34,14 +35,6 @@