meteor-tabular icon indicating copy to clipboard operation
meteor-tabular copied to clipboard

Support local / client-only collections and data arrays

Open petrometro opened this issue 10 years ago • 21 comments

Really great package - thanks so much for putting it together !

A question - would it be possible to use a client-side only collection as the data source ?

A first crack at it : by adding a clientOnly parameter, i got the datatable to display a client-side collection, and it sorts correctly. However since you do the search and pagination via subscriptions, I'm not getting that part to work.

https://github.com/petrometro/meteor-tabular/blob/master/client/tabular.js (cf. lines 140, 143, 251, 272)

petrometro avatar Jan 22 '15 21:01 petrometro

I have a client-side collection that is created and populated on the client side. I am not able to display the data, though - how to make this work with client side collections?

I can see the table with the columns and all, but it just says "No data available in the table" image If I access the collection directly, I can see the data - anything I am missing?

KrishnaPG avatar Mar 16 '15 11:03 KrishnaPG

I'm having the same issue.

jasonbahl avatar Jun 13 '15 21:06 jasonbahl

This would definitely be nice to be able to do. That or being able to create a table from an array within a document, as per Issue #102 . I created a local collection as a workaround for that limitation, not realizing this limitation existed. Creating a persistent collection just to be able to create a table from embedded data is messy and inefficient.

jowilhnson avatar Aug 17 '15 16:08 jowilhnson

I agree - this would be nice to have!

datanotion avatar Sep 10 '15 23:09 datanotion

  • 1

joaopiopedreira avatar Dec 10 '15 17:12 joaopiopedreira

+1

mcissel avatar Dec 16 '15 02:12 mcissel

+1

allenfuller avatar Feb 07 '16 19:02 allenfuller

+1 Being able to directly make tables from nested collection data would be great, but being able to use a local collection would suffice as spinning off nested data into a local collection to create the table would work well enough.

In a table heavy application I've got a dozen tabular tables, and a dozen other places where I've got hand coded tables or other solutions for presenting nested data that would be much improved by being tabular tables.

jowilhnson avatar Feb 18 '16 18:02 jowilhnson

+1

Ossip avatar Mar 08 '16 19:03 Ossip

+1

U54 avatar May 24 '16 09:05 U54

@KrishnaPG @jasonbahl I am having the same issue as well using a local client-side collection. How did you get yours working?

screen shot 2016-05-25 at 1 52 29 pm

IncidentsTable = new Mongo.Collection(null);

TabularTables.IncidentsTable = new Tabular.Table({
  name: "Incidents",
  collection: IncidentsTable,
  columns: [
    { data: 'incident_id', title: 'Incident ID' },
    { data: 'incident_type', title: 'Type' },
    { data: 'incident_source', title: 'Source' },
    { data: 'associated_alarms', title: 'Associated Alarm IDs' },
    { data: 'incident_regions', title: 'Regions' },
    { data: 'bounce_count', title: 'Bounce/Flap Count' }
  ]
});

Meteor.isClient && Template.registerHelper('TabularTables', TabularTables);
{{> tabular table=TabularTables.IncidentsTable class="table table-striped table-bordered table-condensed"}}

And in my template creation I am populating IncidentsTable with the needed data. You can see in my console IncidentsTable.findOne({}) has data. Not quite sure why my table doesn't display any data. Unless it is somehow rendering the table before my local collection has data, but even if that were the case aren't the collections reactive?

chriscarpenter12 avatar May 25 '16 17:05 chriscarpenter12

@chriscarpenter12 I can't remember if I ever did get it working. . .at the time I was working on just a hobby project that I haven't touched basically since last June. . .and unfortunately haven't had time to do much other serious Meteor development since then.

jasonbahl avatar May 25 '16 18:05 jasonbahl

@jasonbahl No problem, thanks for the response though!

chriscarpenter12 avatar May 25 '16 18:05 chriscarpenter12

I was not able to make it work - moved to some other alternatives (do not remember exactly, but something like manually maintained reactive variables etc.)

KrishnaPG avatar May 26 '16 11:05 KrishnaPG

I ended up using ephemer:reactive-datatables because all of my data was located in a sub document inside my collection. I used it with aldeed autoform and collection2. You can pass in whatever data you want. You have to use a meteor method call to the server (in this case) and an autoform hook to update the table after an insert to make it reactive though.

jm1200 avatar May 26 '16 11:05 jm1200

@jm1200 I will try that out. Thanks for the info.

chriscarpenter12 avatar May 26 '16 11:05 chriscarpenter12

@chriscarpenter12 https://github.com/chriscarpenter12 I just comment out this line and it worked for me

Meteor.isClient && Template.registerHelper('TabularTables', TabularTables);

ajmanee avatar Oct 29 '16 17:10 ajmanee

+1

jdnichollsc avatar Dec 22 '16 15:12 jdnichollsc

@petrometro what is the hack to use an array as data? I'm interested about that :)

jdnichollsc avatar Dec 22 '16 15:12 jdnichollsc

Any news on this? I'm also trying to render Array-Object from SimpleSchema to tabular but nothing is working I've tried: { data: "borrowedBy.$.name", title: "Borrowed By Name" }, { data: "borrowedBy.name", title: "Borrowed By Name" }, with no success. Only the title is beeing displayed; date are not pulled from the database. Is it then better to define Schemas without Arrays?

danyhiol avatar Apr 08 '17 22:04 danyhiol

+1

openp2pdesign avatar Dec 19 '17 21:12 openp2pdesign