aslagle / reactive-table

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

Several collections management #169

Open kk4sh opened 9 years ago

kk4sh commented 9 years ago

Hi,

Is there a way to override the default behavior to work with several collections?

Tabular package makes it well, to illustrate the feature: https://github.com/aldeed/meteor-tabular#using-a-custom-publish-function

Thank you

aslagle commented 9 years ago

I've been thinking about allowing collection arrays in ReactiveTable.publish - something like ReactiveTable.publish(name, [collection1, collection2, ...], [selector1, selector2, ...])

But I don't think I'll get to it very soon.

krawalli commented 9 years ago

maybe it would be better to simply accept an array of publication names. So I can use packages like publish-composite to have all data i need for nested (over more than one) collections.

Implementing the use of some publication-names would not be that hard.

In case of this here it might get complicated, since you need a seperate publication for each reactive-table and also separated collection (from the originial collection).

aslagle commented 9 years ago

ReactiveTable.publish sets up the publication with a bunch of custom arguments to enable pagination and filtering, and pushes the items into its own collections - the table won't work with anything that wasn't published through ReactiveTable itself.

I can keep thinking about it, but I don't know how I'd implement reactive joins in a general way - if you need that much customization you'd probably be better off doing your own pagination and filtering.

thosmos commented 9 years ago

I need related table support, but only for subqueries - nothing that would require changes to paging or filtering. The current version of meteor-admin uses a "children" function in the config, which lets you define the composite publish's children subquery for use in its tabular tables and for collection helpers that need to call other collections. I'll attempt it ...

tarzak commented 9 years ago

Hi, aslagle, I would like to thank you for your awesome package. It is really nice. But I really need your advice.

aslagle:

I can keep thinking about it, but I don't know how I'd implement reactive joins in a general way - if you need that much customization you'd probably be better off doing your own pagination and filtering.

Can you tell me pls, how do I make your table work with collection arrays?! I don't need pagination and filtering. Just reactive showing of a few collections.

aslagle commented 9 years ago

If you don't need the server-side options, you can pass reactiveTable an array created from all your collections - set your collection argument to something like [].concat(collection1.find().fetch(), collection2.find().fetch(), collection3.find().fetch()). You'll have to set up your own Meteor.publish and Meteor.subscribe.

tarzak commented 9 years ago

thank you!