acute-select
acute-select copied to clipboard
Data replication
Hi If you have the select with a list of items. If you make any dynamic changes to the page and reload the data, so the changes show on page, the items in the dropdown become replicated. Everytime you make a save, you update the data, angular refreshes it's variables so the user has up to date info and it still replicates in the dropdown. I've tried destroying the the array. emptying the array, everything. I can see angular is emptying it from the console, the data gets trashed and then is reloaded once. . but the dropdown is keeping a copy and just adding to it. It is rather frustrating.
@barhaleacct Sorry for the late response. I'll look into this and tyr to get it fixed. John
Any update on this? Same problem occurring to current date. My list keeps extending even if i recreate it.
Hi, Apologies. I wasn't able to reproduce this issue myself. Any chance you could set up a Plunker or JSFiddle to show the problem? Or failing that, can you tell me what options you're using, particularly how the data is being provided, what's changing in the page and where the data's being updated? Thanks, John
Hi thanks for the response. I have as follows:
In my html I have:
In the controller.js I have a custom made list as this needs to be one level to access the data. i.e. [{"id":1, "display":"Hello World"}] vs [{"id":1, "display":{"new":"Hello World!!", "old":"HiWorld"}}]
Periodically when selecting another switch input, "ac_scheduleSelectOptions" switches between all schedules or schedules not yet completed. I have tested that "ac_scheduleSelectOptions" updates to the correct values pulled from the database but it gets duplicated in the dropdown every time the value is updated. There are 3 schedules in total and 2 incompleted so the list should either be 2 or 3 items.
I found a fix in the "acute.select.js" file.. This is fixed by adding the following line in the "$scope.loadItems" function: //ADD THE FOLLOWING LINE TO RESET THE ARRAY $scope.items = [];
Change:
to
OK, I'll test that change and commit if all looks OK.