Situation
I’m using the fantastic aldeed:tabular
package by @aldeed for a fairly large table in my app like so:
{{> tabular id="datatable" table=TabularTables.MyCollection class="table compact"}}
Goal
The compact
class controls the density of the layout and can be toggled by the user.
The change in density is animated with css transitions.
So by default (with the compact
class) the table looks like this:
While without the compact
class it smoothly animates to this:
Great!
Problem
I could store the layout density in a Session (default/compact) and create a helper for this.
Non-Solution # 1:
I can’t really use this helper like this, because this just doesn’t make sense:
{{> tabular id="datatable" table=TabularTables.MyCollection class="table {{#if layoutCompact}}compact{{/if}}"}}
Non-Solution # 2:
I also can’t just do it like so, since this would break the css transitions:
{{#if layoutCompact}}
{{> tabular id="datatable" table=TabularTables.MyCollection class="table compact"}}
{{else}}
{{> tabular id="datatable" table=TabularTables.MyCollection class="table"}}
{{/if}}
Is there a way to achieve this?
Thanks!