adopted-ember-addons / ember-light-table

Lightweight, contextual component based table for Ember
http://adopted-ember-addons.github.io/ember-light-table/
MIT License
312 stars 131 forks source link

Set cell rowspan based on row value #597

Open fran-worley opened 5 years ago

fran-worley commented 5 years ago

I thought this would be relatively straight forward using a custom cell type:

import Cell from 'ember-light-table/components/cells/base';
import { computed, get } from '@ember/object';

export default Cell.extend({
  attributeBindings: ['rowspan'],
  rowspan: computed('row.content.expanded', 'row.subtaskCount', function() {
    if (get(this, 'row.expanded')) {
      return get(this, 'row.subtaskCount');
    }
  })
});

However what I find is that row properties are always either null or undefined no matter what I do! Am I missing something?

A followup point to this would be how to disable a cell rendering at all based on a value. Essentially, if my row is 'expanded', I want the first column to span the expanded rows and the expanded rows not to include the first column.

Note: I'm not using the standard implementation of expanded here in favour of something along these lines

alexander-alvarez commented 5 years ago

Hey @fran-worley sorry you're struggling with this.

A followup point to this would be how to disable a cell rendering at all based on a value. Essentially, if my row is 'expanded', I want the first column to span the expanded rows and the expanded rows not to include the first column.

It may be because I haven't had my :coffee: but I'm not following this -- would it be possible to throw up a quick demo (or screenshots) that I can see to understand more clearly what you mean?