From b1f5bc830b333234a35999785a4e6110bad46bce Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 1 Feb 2021 09:43:52 -0500 Subject: [PATCH] dev/core#2347 Search Kit: Fix 'Select All' in table display --- .../crmSearchDisplayTable.component.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/search/ang/crmSearchDisplayTable/crmSearchDisplayTable.component.js b/ext/search/ang/crmSearchDisplayTable/crmSearchDisplayTable.component.js index bdcd65683a..1606ef39a0 100644 --- a/ext/search/ang/crmSearchDisplayTable/crmSearchDisplayTable.component.js +++ b/ext/search/ang/crmSearchDisplayTable/crmSearchDisplayTable.component.js @@ -82,14 +82,16 @@ } // Select all ctrl.allRowsSelected = true; - if (ctrl.page === 1 && ctrl.results[1].length < ctrl.apiParams.limit) { - ctrl.selectedRows = _.pluck(ctrl.results[1], 'id'); + if (ctrl.page === 1 && ctrl.results.length < ctrl.apiParams.limit) { + ctrl.selectedRows = _.pluck(ctrl.results, 'id'); return; } // If more than one page of results, use ajax to fetch all ids $scope.loadingAllRows = true; var params = _.cloneDeep(ctrl.apiParams); - params.select = ['id']; + delete params.limit; + // Select only ids unless HAVING clause is present + params.select = params.having && params.having.length? params.select : ['id']; crmApi4(ctrl.apiEntity, 'get', params, ['id']).then(function(ids) { $scope.loadingAllRows = false; ctrl.selectedRows = _.toArray(ids); -- 2.25.1