ractive-ez-table
Version:
Ractive Ez UI Table
37 lines (28 loc) • 960 B
JavaScript
import Ractive from 'ractive';
import EzTableContent from './EzTableContent.js';
const EzTableGroup = Ractive.extend({
template: require("./EzTableGroup.html"),
components: {
EzTableContent: data => EzTableContent
},
_getGroupValueTemplate(column) {
return column.groupValueTemplate
|| "{{ value }}";
},
_getGroupLabelTemplate(column) {
return column.groupLabelTemplate
|| "{{ grouping.column.label }} : "
+ "{{#with grouping.value as value }}"
+ this._getGroupValueTemplate(column)
+ "{{/with}}"
+ " ({{ grouping.items.length }})";
},
labelTemplate(column) {
const name = "group-" + column.name;
if (!this.partials[name]) {
this.partials[name] = this._getGroupLabelTemplate(column);
}
return name;
}
});
export default EzTableGroup;