-
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
Some newb questions #27
Comments
@landland sorry for the late response, thought I already answered this, but I guess it was just in my imagination. Question 1You can limit the data set published by the DataTable component on the server by specifying a query parameter. On the server : RowsTable = new DataTableComponent
subscription: "rows"
collection: Rows
# ##### Only return the rows created today
query:
createdAt: $gte: moment().startOf( "day").toDate()
RowsTable.publish() Or if you need access the the publication context ( to check the userId for example ) use a function for the query property. RowsTable = new DataTableComponent
subscription: "rows"
collection: Rows
debug: "userId"
# ##### Only return rows this user owns
query: ( component ) ->
component.log "userId", this.userId
return { owner: this.userId }
RowsTable.publish() You can also define a query on the client, which will let you limit the subscription even further. This way you can have a general subscription that publishes data for several tables, and then the tables can limit the data further for their needs. Question 2Accessing nested properties has been working fine for me and a few other users, but I will take a second look as soon as possible. To help me isolate the problem can you put together a small example the replicates the issue? I believe the issue may not be the DataTable but instead the publication that is providing the data, and that perhaps the nested properties are not being published? Whatever the case, being able to replicate the issue quickly will really help speed things along.
|
Hi Austin and @landland! I'm having the same two issues. Did you figure out what was going on? I've never worked with the standard (non-meteor) jquery datatable, so some of this is still magic to me. I got the data table working for properties of the base object (a Meteor.user) but I can't seem to get any nested data (see columns below) into the data tables. The jquery-datatables debug: "all" gives me the following output for one of the users:
This is in my template:
And then on the server:
I realised my problem with the server-side query is that it's looking for the specified values, rather than only returning certain fields. Is it possible to specify only certain fields to return? That would speed up the queries a lot. Can you point me to where the dot notation gets turned into subobjects? Thank you for your time. |
ephemer -- did you find a solution to this problem? I would also like to publish only selected fields to the client via datatables. |
Hi Max, The solution I went with in the end was a custom one (my workmate and I wrote our own wrapper). It works surprisingly well: it takes any standard cursor you give it (you choose the fields), it's clean, reactive, and FAST (instantaneous) for our uses (a few thousand records each table). It doesn't access the server for display filter or sort requests. We're in a busy period until mid September but at that point I'd strongly consider open-sourcing our version. Interest from you and others would obviously help to motivate that move. Cheers, ephemer On Wed, Aug 27, 2014 at 12:15 AM, Max Kolysh [email protected]
|
@maxko87 I've open sourced what we came up with. Any feedback is welcome and encouraged! |
Hi there, I have some simple questions that I haven't been able to figure out with this package.
question 1. In the normal Meteor way, I'd publish a collection like this (sorry I don't know coffeescript)
but what is the equivalent with dataTables if I wanted to pass in a listId? Just from the example, I have the following that returns all collection items rather than a subset since I am not adding listId to the query.
question 2. I have a table that has returned, but some columns are blank. I think it has to do with the nested object structure. So if I have a Profile with a name at "contact.name" that column returns blank.
I hope I am clear. Let me know if it doesn't make sense, thanks for any help.
The text was updated successfully, but these errors were encountered: