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

revealItem not working on newly added element #25

Open
rtheuwen opened this issue Feb 13, 2017 · 3 comments
Open

revealItem not working on newly added element #25

rtheuwen opened this issue Feb 13, 2017 · 3 comments

Comments

@rtheuwen
Copy link

In my view I have a table displaying users from a users array, which is binded to data.bind: users; display-data.bind: $displayData; like this. It all works fine. On this page, I also have a modal to add a new user. The new user gets added to the users array and to a local json server (for now). If I then try to do revealItem on this added user, the functions returns false. What do I need to do for the plugin to see this change in data?

@tochoromero
Copy link
Owner

I believe I know what is going on. If you add the element and immediately ask to reveal it, the reveal method will not find the element in the list, it is a timing issue.
I have started some work to internally use promises to avoid this kind of issues, but it is not ready yet.

On the meantime, you can wait a little bit after adding the new item to call the function to reveal the item. I know it is not pretty, but it should get the job done.

@rtheuwen
Copy link
Author

Putting it in a timeout did the trick indeed, it works now. Looking forward to the promises for a cleaner solution. Thanks for the quick reply! Good job on the plugin.

@alexricketts325
Copy link

Has there been any update to this issue?

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

3 participants