aslagle / reactive-table

A reactive table designed for Meteor
https://atmospherejs.com/aslagle/reactive-table
Other
328 stars 138 forks source link

show loader until data is ready for client #476

Closed dharmiksolanki1992 closed 7 years ago

dharmiksolanki1992 commented 7 years ago

i have used meteor reactive-table https://github.com/aslagle/reactive-table for show data listing. how to use ready: ReactiveVar(Boolean) option in settings code. give example.

aslagle commented 7 years ago

Sorry I don't have an example of that. The ready setting only works if you're using ReactiveTable.publish on the server, and have other code that needs to know when the data is ready on the client. If that applies to you, you can create a ReactiveVar with new ReactiveVar(), and add it to the table arguments, and check it in other parts of your code. It will start out false and change to true when the data is ready.

dharmiksolanki1992 commented 7 years ago

Using ReactiveVar we can get subscription is ready or not.

Template.myTemplate.onCreated(function(){
  this.isSubscriptionReady = new ReactiveVar(false);
});

Template.myTemplate.helpers({
  settings: function () {
    return {
      collection: collection,
      rowsPerPage: 10,
      showFilter: true,
      fields: ['name', 'location', 'year'],
      ready: Template.instance().isSubscriptionReady
    };
  },
  isSubscriptionReady: function () {
     return Template.instance().isSubscriptionReady.get();
  }
});
vladbalan commented 4 years ago

@aslagle Is there any way to achieve this for when changing pages or filters?