Skip to content
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

Reloading options based on events #10

Open
ajeyak opened this issue Aug 19, 2015 · 2 comments
Open

Reloading options based on events #10

ajeyak opened this issue Aug 19, 2015 · 2 comments

Comments

@ajeyak
Copy link

ajeyak commented Aug 19, 2015

React calls render() when the state of the component changes. If a component uses this Multiselect widget and repaints itself when the web server responds with options for the dropdown, this multiselect does not repaint itself. The alternative is to implement the React component's componentDidMount() and call $.multiselect("dataprovider", options) inside it. This is straying from react's principles. Is this a known bug?

@skratchdot
Copy link
Owner

Yes, it's a known limitation. This component was a lazy solution to a React project I was working on (and doesn't follow React's prop/state principles). See: #8

Someone added a syncData method which might do what you want. I tried a few methods of updating the options on every render(), but would always run into weird behavior. For this component to follow React principles correctly, I'd either need to rewrite the base/upstream library completely, or get a few pull requests merged into the base library.

@ajeyak
Copy link
Author

ajeyak commented Aug 20, 2015

Thanks for responding! syncData() works and I can move on for now. This is a great widget and it would be really nice if it adheres more closely to react's principles, but I understand what you're saying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants