Open fipke opened 9 years ago
Hi Djeimi,
In Columns please try to add ID using which you are trying to fetch the data, even if you dont want to show it, You can later hide this using columnDefs.
I cannot fully understand your code, But let me give you one example very quickly. Here I was not using the ParentID but If I don't use it I cannot able to perform my queries using the publishComposite
columns: [
{data: "name", title: "Title"},
{data: "parentID", title: "parentID"},
{data: "parentcategory()", title: "Parent Category"}
],
"columnDefs": [
{
"targets": [ 1 ],
"visible": false,
"searchable": false
},
{
"targets": [ 2 ],
"visible": true,
"searchable": true,
"sortable": true
}
]
});
In publishComposite I have to use it like this:
children: [
{
find: function(placementcategories) {
return Categories.find({ _id: categories.parentID });
}
}
So my suggestion is to try it and see if it work.
Thanks for asking if I could have given some direction that would be great.
Manu
It works. Thank you @manusharma1 . But unfortunately isn't possible to find or sort by the "updatedAt" or "ingrediente" fields. Thank you
Yes, This is same thing is also happening with me. I am unable to sort or search, Can you please check if others are also facing this or they have any solution for this, otherwise you can raise this issue and I will also support you as I am also looking for the same solution.
Please do update me if you get any answer to this issue or will raise new issue.
Thanks, Manu
In the ingrediente
helper, it should be findOne
instead of find
. I don't see any other problems.
Hello @aldeed I tried but I still have to do like @manusharma1 commented. I have to define a column "IngredienteId" an later hide the column with the ID. If I don't specify the "ingredienteId" I do not receive a entire PrecoIngrediente Json. Is correct specify the column with ID and then hide it later? Should it work automatically with definition:
TabularTables.PrecoIngredientes = new Tabular.Table({
name: "PrecoIngredientes",
collection: PrecoIngredientes,
pub: "precoIngredientes_Composite",
columns: [
{data: "quantidade", title: "Quantidade"},
{data: "preco", title: "Preco"},
{data: "ingrediente()", title: "Ingrediente"},
{data: "updated()", title: "Updated By"},
]
});
Hey @fipke , here is what I think is happening:
When your TabularTable
subscribes to your custom publication it asks for the fields present in the columns
property via the fields
parameter sent to you publication. You can however include an additional property called extraFields
and extend the fields param with that value
The way @aldeed's original code handles that is here: https://github.com/aldeed/meteor-tabular/blob/02ff9a8fd22fd43d0a094e58c89d6b869fde2bfa/server/tabular.js#L27
And copied here for convenience:
var table = Tabular.tablesByName[tableName];
if (!table) {
// We throw an error in the other pub, so no need to throw one here
self.ready();
return;
}
// Extend fields list with extra fields from the table definition
if (table.extraFields) {
_.extend(fields, table.extraFields);
}
Hello, sorry if my question is too easy, I'm starting with Meteor
I have the following configuration, but the columns with title "Ingrediente", "Updated By" are empty in the DataDatable
/app/lib/controllers/preco_ingredientes_controller.js
/app/server/publish.js
/app/client/templates/preco_ingredientes/preco_list/preco_ingredientes_list_new.html
/app/lib/collections/preco_ingredientes.js
Chrome Console
Server log from publishComposite:
What am I doing wrong?
Thank you