meteor-tabular
meteor-tabular copied to clipboard
selector not working
Hi,
I have upgraded my meteor application from 1.4 to 1.8 but unfortunately my tabular data is not working anymore. Basically I can see the first 10 records but when i click next page nothing happens. Additionally the sorting only works for the records shown instead triggering a new query.
Where did I go wrong because this used to work before the upgrade.
Regards, Emanouil
This is good to know. I'm not sure of the answer, but this package hasn't been updated in 18 months. Have you tried checking out any of the forks to see if they work correctly? Would be curious to know as I have a 1.5.x app I want to upgrade to 1.8.x and I use this package a lot.
There's also this package which looks to be an improvement. You could check this out:
https://bitbucket.org/znewsham/meteor-dynamic-tables/src/master/
I've found that using the selector function reactive, it is runs (because of Tracker.autorun) too often and prevents going to the next page. By being careful with assigning to those ReactiveVars only when actually changed (see below) this is prevented.
I use this code (both server & client):
import { ReactiveVar } from 'meteor/reactive-var'
import equal from 'fast-deep-equal'
ReactiveVar.prototype.setIfChanged = function(val) {
if (!equal(val,this.get())) {
return this.set(val)
}
}
and then use <ReactiveVar>.setIfChanged(value) to make the selector only be called (autoran) when actual new values arrive.
Hope it helps!