aslagle / reactive-table

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

Get access to row object in template function #453

Closed spiotr12 closed 7 years ago

spiotr12 commented 7 years ago

This might be more as dev request:

It would be great to pass current collection object to the tmpl function for fields

Reason: use different templates depend on value. Is this would be possible.

this does not access the collection object

E.g.:

tmpl: function (value, object, key) {
    if (value = 'foo') {
        return Template.details_field;
    }
}
aslagle commented 7 years ago

It is possible to write a template that checks the value and renders different templates, but I guess it's not as convenient as it could be.

spiotr12 commented 7 years ago

The way I finally solve it was to create a template helper which was rendering different text <- so similarly to way you suggest