Last active
August 29, 2015 14:15
-
-
Save taras/c7c9d938f1518623e1e8 to your computer and use it in GitHub Desktop.
Ember Table 2.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Table Template | |
``` | |
{{#if template}} | |
{{yield columns rows}} | |
{{else}} | |
{{#ember-table data=data columns=columnsData as |columns rows|}} | |
{{#table-header columns=columns as |name|}} | |
{{name}} | |
{{/table-header}} | |
{{#table-body rows=rows as |value column|}} | |
{{value}} | |
{{/table-body}} | |
{{#table-footer as |summary column|}} | |
{{summary}} | |
{{/table-footer}} | |
{{/ember-table}} | |
{{/if}} | |
``` | |
# Barebone Table | |
``` | |
{{#ember-table data=data columns=columnsData as |columns rows|}} | |
{{#table-header columns=columns as |name|}} | |
{{name}} | |
{{/table-header}} | |
{{#table-body rows=rows as |value column|}} | |
{{value}} | |
{{/table-body}} | |
{{#table-footer as |summary column|}} | |
{{summary}} | |
{{/table-footer}} | |
{{/ember-table}} | |
``` | |
# Sorting | |
``` | |
{{#ember-table data=data columns=columnsData as |columns rows|}} | |
{{#table-header columns=columns as |name column|}} | |
{{#action 'sortData' column}}{{name}}{{/action}} | |
{{/table-header}} | |
... | |
{{/ember-table}} | |
``` | |
# Customizing Table Cells | |
``` | |
{{#ember-table data=data columns=columnsData as |columns rows|}} | |
{{#table-body rows=rows as |value column|}} | |
{{#if (eq column.type 'date')}} | |
{{format-date value}} | |
{{else if (eq column.type 'component')}} | |
{{component column.componentName value=value}} | |
{{else}} | |
{{value}} | |
{{#if}} | |
{{/table-body}} | |
... | |
{{/ember-table}} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment