diff --git a/drone-pr-workaround.sh b/drone-pr-workaround.sh old mode 100755 new mode 100644 diff --git a/js/ui/collection/ui.collection_widget.edit.js b/js/ui/collection/ui.collection_widget.edit.js index 5784b1d7b48a..e704a570f942 100644 --- a/js/ui/collection/ui.collection_widget.edit.js +++ b/js/ui/collection/ui.collection_widget.edit.js @@ -198,6 +198,10 @@ var CollectionWidget = BaseCollectionWidget.inherit({ return !!(this._dataSource && this._dataSource.key()); }, + _getCombinedFilter: function() { + return this._dataSource && this._dataSource.filter(); + }, + keyOf: function(item) { var key = item, store = this._dataSource && this._dataSource.store(); @@ -225,9 +229,7 @@ var CollectionWidget = BaseCollectionWidget.inherit({ that._updateSelectedItems(args.addedItems, args.removedItems); } }, - filter: function() { - return that._dataSource && that._dataSource.filter(); - }, + filter: that._getCombinedFilter.bind(that), totalCount: function() { var items = that.option("items"); var dataSource = that._dataSource; @@ -572,7 +574,10 @@ var CollectionWidget = BaseCollectionWidget.inherit({ } break; case "dataSource": - this.option("selectedItemKeys", []); + if(!args.value || !args.value.length) { + this.option("selectedItemKeys", []); + } + this.callBase(args); break; case "selectedIndex": diff --git a/js/ui/list/ui.list.edit.js b/js/ui/list/ui.list.edit.js index 7d7dcc4969ce..ea466c3051d7 100644 --- a/js/ui/list/ui.list.edit.js +++ b/js/ui/list/ui.list.edit.js @@ -281,6 +281,20 @@ var ListEdit = ListBase.inherit({ } }, + _getCombinedFilter: function() { + var filter, + storeLoadOptions, + dataSource = this._dataSource; + + if(dataSource) { + storeLoadOptions = { filter: dataSource.filter() }; + dataSource._addSearchFilter(storeLoadOptions); + filter = storeLoadOptions.filter; + } + + return filter; + }, + _isPageSelectAll: function() { return this.option("selectAllMode") === "page"; }, diff --git a/testing/tests/DevExpress.ui.widgets/listParts/editingTests.js b/testing/tests/DevExpress.ui.widgets/listParts/editingTests.js index d50fcd496eaa..7cad70651e42 100644 --- a/testing/tests/DevExpress.ui.widgets/listParts/editingTests.js +++ b/testing/tests/DevExpress.ui.widgets/listParts/editingTests.js @@ -505,6 +505,42 @@ QUnit.test("selection works well after clean all selected items and selectAllMod assert.equal(selectionChangedSpy.callCount, 3, "'selectionChanged' event has been fired 3 times"); }); +//T567757 +QUnit.test("Selecting all filtered items when selectAllMode is 'allPages'", function(assert) { + //arrange + var items = [1, 2, 3, 4, 5], + $selectAll, + ds = new DataSource({ + store: items, + pageSize: 2, + paginate: true, + searchValue: "1" + }); + + var instance = $("#list").dxList({ + dataSource: ds, + showSelectionControls: true, + selectionMode: "all", + selectAllMode: "allPages" + }).dxList("instance"); + + //act + instance.selectItem(0); + + //assert + $selectAll = $("#list").find(".dx-list-select-all-checkbox"); + assert.ok($selectAll.hasClass("dx-checkbox-checked"), "selectAll checkbox is checked"); + assert.deepEqual(instance.option("selectedItems"), [1], "selected items"); + + //act + ds.searchValue(""); + ds.load(); + + //assert + $selectAll = $("#list").find(".dx-list-select-all-checkbox"); + assert.ok($selectAll.hasClass("dx-checkbox-indeterminate"), "selectAll checkbox is indeterminate"); +}); + var LIST_ITEM_SELECTED_CLASS = "dx-list-item-selected"; QUnit.module("selecting in grouped list", { diff --git a/testing/tests/DevExpress.ui/collectionWidgetParts/editingTests.js b/testing/tests/DevExpress.ui/collectionWidgetParts/editingTests.js index f4c2c8c53225..e3b390137c01 100644 --- a/testing/tests/DevExpress.ui/collectionWidgetParts/editingTests.js +++ b/testing/tests/DevExpress.ui/collectionWidgetParts/editingTests.js @@ -551,7 +551,7 @@ var runTests = function() { } }); - QUnit.test("selectedItems should be cleared if datasource instance has been changed", function(assert) { + QUnit.test("selectedItems should be cleared if datasource instance has been changed to null", function(assert) { var instance = new TestComponent($("