Monasha Monasha - 28 days ago 8
HTML Question

Pass argument to collection in meteor reactive-table

I am using package

aslagle:reactive-table


I want to pass an argument to the
collection
option of the reactive table

I have checked this also Meteor Reactive Table Helper Arguments but the comments on the post didn't help.

Html Code:

{{#each staffCode}}
{{> reactiveTable collection=collectionDetails settings=settingsResult}}
{{/each}}


Helper:

collectionDetails: function(staffCode){
return someCollection.find({staff_code: staffCode});
},
settingsResult: function(){
return {
rowsPerPage: 20,
showFilter: false,
showNavigation: 'auto',
fields: [
{
key: 'some_key', label: 'Some Label' ,
}
]
}
}


So far I tried putting

{{#each staffCode}}
{{> reactiveTable collection=collectionDetails ../code settings=settingsResult}}
{{/each}}


But this doesn't work and gives the following error in the terminal

Can't have a non-keyword argument after a keyword argument

Answer

Those who have the same issue, I have solved the problem, here's the way I approached it.

{{#each staffCode}}
    {{#with collectionDetails code}}
        {{> reactiveTable collection=this settings=settingsResult}}
    {{/with}}
{{/each}}
Comments