-
Notifications
You must be signed in to change notification settings - Fork 29
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
Pagination intermittently doesn't work #40
Comments
Hi Francis, It's possible, looking at your code, that you've hit the same problem I hope I've just solved. You have structured things the same way I had, by implementing the DataTables configuration as a template helper. After going through a whole evening's worth of trial and error contrasting what I had against the example, I put the config in the data property of the IronRouter controller thus:
While this has fixed the problem I'd be interested to hear Austin's thoughts. Especially as the README.md shows exactly the "broken" technique. Hope this helps! |
I encountered the same problem today, and after spending hours and hours… i've found a solution: change the "id" to an random value like Meteor.uuid(). pull request: https://github.com/francisbyrne/finance/pull/79 my bug reproduction process: go to http://localhost:3000/ |
@joramhoefs that is one strange fix. It's quite hard to comprehend how that would make a difference as afaik that value is just used to provide a DOM element id to assist in applying CSS, etc. For this reason using a UUID is certainly counter to this purpose of this property! |
Thanks so much @joramhoefs! It fixes my problem so I've merged the pull request but I think I'll leave this issue open for @austinrivas to respond to because it seems like a weird fix and maybe masking an underlying issue as @serenitus mentioned. |
yes, it's not a clean solution. rather a dirty workaround with a slightly sarcastic note. |
I wonder if there's a problem whereby the rendering stage is finding that a DOM element with the specified id already exists. That would perhaps explain why your change works. |
@joramhoefs Weirdly enough, your fix with It appears we are opening a can of worms for this package! 😟 |
Ah, I see what is happening. Every time it re-renders the table after the reactive query changes, it uses the original selector to get the table DOM but, since that has changed to a new uuid, it doesn't find anything. Two solutions:
@austinrivas What do you think? |
@francisbyrne 1) sort of defeats the purpose of the id. You might as well just look up the class instead. Kills any potential for having multiple tables on the page also. 2) That would be the correct thing to do IMO. There's 3) if you're using IronRouter, switch to the mechanism I described in my first response. |
Hey folks, @austinrivas has been sick the last week which is why it's been so quiet around here. He should be back to work sometime next week, I think. Just wanted to give you all a heads up. |
@chadrik thanks, good to know. |
@francisbyrne for me it looks like:
|
@serenitus Hmmm, I can't seem to get it working with your approach. Firstly, the reactive query doesn't work with this solution it seems; I just keep getting Secondly, even if I ignore the query, I still get the same pagination issues as before. So I'm just going to switch back to having it in the helper and see what @austinrivas comes back with regarding the pagination issues. |
@francisbyrne So I now have a reactive query working also using my technique. I see the recompute error occasionally though so it looks like there's a race somewhere. I'll try and investigate tonight. |
@francisbyrne looks like the race issue was a correct guess. I moved my initialization of the reactive query That has done the trick. [EDIT] Spoke too soon. That worked for the first filter only! Subsequent filter entries did nothing. sigh |
Has anyone had any luck battling with this lately? BTW not sure if it is any help but this seems related to be the same issue I documented here also: #38 I feel like there could be a hack that just erases everything connected to table when the template is destroyed but I haven't had any luck. |
@jcswanson the core issue is that meteor does not preserve the template context on reactive rerenders, which destroys the datatable instance that is bound to the template component. Once the meteor team adds an I'm hesitant to apply any more work arounds until the |
Hi @austinrivas, I really appreciate your hard work on this component! Is it possible for us to hack in an updated callback until then? I really want take advantage of all your hard work, this looks way better than reactive tables. Do you have an MDG bug ID for this issue? Thank you |
It's not technically a bug so much as a needed feature, there is an entry on the meteor trello roadmap that identifies the issue. Please bump it if you have the time https://trello.com/c/bv3pmX2x/51-fancy-animation-support & https://trello.com/c/Jg9N9F1l/62-new-object-oriented-api-for-ui-components |
I've noticed that the pagination for Collections-based datatables just doesn't work sometimes. It seems to happen when you navigate away from a page with a datatable on it (via iron-router) then navigate back to the original page and use the pagination.
To Reproduce:
mrt install; meteor
localhost:3000
in browserloadDummyImports()
(that will load a bunch of trades to populate the table)I'll try and reproduce it with a simpler example but here are some screenshots from my finance project in the meantime.
The text was updated successfully, but these errors were encountered: