Skip to content

Commit 3c37584

Browse files
committed
Add debounce option for filtering
1 parent c7e20a0 commit 3c37584

File tree

1 file changed

+8
-4
lines changed
  • src/Umbraco.Cms.Integrations.Crm.ActiveCampaign/App_Plugins/UmbracoCms.Integrations/Crm/ActiveCampaign/js

1 file changed

+8
-4
lines changed

src/Umbraco.Cms.Integrations.Crm.ActiveCampaign/App_Plugins/UmbracoCms.Integrations/Crm/ActiveCampaign/js/formpicker.controller.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
vm.changePage = goToPage;
2020
vm.goToPage = goToPage;
2121

22-
vm.filterForms = () => {
23-
loadForms(vm.pagination.pageNumber, vm.searchTerm);
24-
}
25-
2622
umbracoCmsIntegrationsCrmActiveCampaignResource.checkApiAccess().then(function (response) {
2723
vm.isApiConfigurationValid = response.isApiConfigurationValid;
2824
if (response.isApiConfigurationValid) {
@@ -71,6 +67,14 @@
7167
editorService.open(options);
7268
};
7369

70+
let timer;
71+
vm.filterForms = () => {
72+
if (timer) {
73+
clearTimeout(timer);
74+
}
75+
timer = setTimeout(() => { loadForms(vm.pagination.pageNumber, vm.searchTerm); }, 500);
76+
}
77+
7478
function getFormDetails(id) {
7579
vm.loading = true;
7680
umbracoCmsIntegrationsCrmActiveCampaignResource.getForm(id).then(function (response) {

0 commit comments

Comments
 (0)