-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content of dropdown list not updated when bound collection is replaced #34
Comments
Right, I didn't think about that possibility and so the problem is that there's no Possibly adding this piece of code would help collectionChanged(newCollection, oldCollection) {
this.collection = newCollection;
} However this probably won't be enough, I'm not sure what will happen with your previous selections. It might be expected to reset the selection to empty? or remain the same selection, if it exist in the new collection? Feedback and/or PR are welcome. |
Oh ok I see. As for previous selections: That is a good question. For my specific use case, I don't care about that, as I explicitly reset it in my ViewModel anyway, so resetting would be fine. That doesn't have to be the case, though. For "least suprise", I'd try emulate Aurelia's behavior with |
Thanks for the emulation, but it might be missing a use case. I'm not sure what would happen if some (but not all) selections would not be part of the future collection. I'm assuming that user wouldn't want to see a selection that doesn't exist in the new collection. That might be tricky to deal with, or at least the steps would be to (1) keep a variable of the selections, (2) update the collection, (3) loop through the new collection with the previous selections and disregard the ones that don't exist. I'm not sure how I would deal with number (3) yet. Also please note that these plugins are all done in my spare time and it might take couple weeks before they are being addressed. However PR are very welcome and could potentially be addressed faster. Thanks for using the plugin(s) and providing feedback :) EDIT |
Well, my take would be to keep it simple and work with indexes, just the way Aurelia seems to do with vanilla Won't have time for creating a PR any time soon though, sorry :-(. In the meantime, I'm using a more lightweight alternative - found a relatively simple way for directly bridging the bootstrap-select jQuery plugin with Aurelia via a custom attribute for |
So I passed over half a day on this and it's halfway working. It works with a simple collection but as soon as the collection has things like subtext, content or others, it doesn't work for them. I found out after a while that there was a timing issue and that placing the picker refresh inside a I pushed a new version If anyone knows how to fix it, please help... here's my current code for the collection changed collectionChanged(newCollection, oldCollection) {
setTimeout(() => {
this.domElm
.selectpicker('render')
.selectpicker('refresh');
});
} |
i use content parameter to set the option as an image, so this is still not working for me in 1.1.1 and with the additional .render() and .refresh() calls on the element (set via element.bind). |
Unless you find an alternative, I have no clue how to deal with this problem since it's mainly a problem with the 3rd party plugin itself. PR are welcome, else than that I already spent way to much time on this and out of ideas on how to fix it. |
Thanks to @Mobe91 You can give it a try with a regular collection and see that it works. If anyone find a way to fix the entire thing, that is changing a collection with |
I use abp-select in a table like this:
Now the problem is that
item.subItems
may change (i.e. the entire array gets replaced); but when it does, the content of the dropdown list doesn't change.By contrast, when I use a regular
<select>
, it works as expected, i.e. the<option>
list get updated whenitem.subItems
changes:Am I using
<abp-select>
incorrectly, or is this a bug?The text was updated successfully, but these errors were encountered: