Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It appears that ember-light-table is having lot of issues with ember-octane? are there any solutions for this that i should look into? has anyone else had these issues? #724

Closed
ahemed-haneen opened this issue Nov 14, 2019 · 8 comments

Comments

@ahemed-haneen
Copy link

ahemed-haneen commented Nov 14, 2019

[ember-light-table] table must be an instance of Table

This is the error thats popping up right now

@richard-viney
Copy link
Contributor

You'll need to be on the latest 2.0 beta release, and use Table.create(...) rather than new Table(...). See #726.

@fran-worley
Copy link
Contributor

There are a few issues with Octane, though none should stop you from being able to use the addon providing you're on v2.x as @richard-viney has said.

We're actively working on full support for Octane features as we speak so keep in touch!

@surekha199
Copy link

You'll need to be on the latest 2.0 beta release, and use Table.create(...) rather than new Table(...). See #726.

am getting below error with Table.create()

Assertion Failed: [ember-light-table] columns must be an array if defined", …}

@richard-viney
Copy link
Contributor

@surekha199 Perhaps double-check what arguments you're passing to Table.create().

@surekha199
Copy link

import { inject as service } from '@ember/service';
import Component from '@ember/component';
import layout from './template';
import { debounce } from '@ember/runloop';
import moment from 'moment';
import Table from 'ember-light-table';
import { computed } from '@ember/object';
import { task } from 'ember-concurrency';
import Row from 'ember-light-table/classes/Row';
import { A as emberArray, makeArray } from '@ember/array';

export default Component.extend({
columns: computed(function() {
return [ {
label: 'Id',
valuePath: 'id',
width: '150px'
}, {
label: 'Type',
valuePath: 'type',
width: '150px'
}, {
label: 'Hit-Points',
valuePath: 'healthpoints',
width: '150px'
}
];
}),
model: computed(function() {
return [{
id: 'Quarkos',
type: 'Water',
healthpoints: 12,
weakness:'Fire',
picture: 'https://upload.wikimedia.org/wikipedia/commons/a/a7/3195dialock.png',
},
{
id: 'Gaeas',
type: 'Earth',
healthpoints: 15,
weakness:'Water',
picture: 'https://upload.wikimedia.org/wikipedia/commons/9/9b/Amelie_300dpi.png',
}, {
id: 'Lightos',
type: 'Fire',
healthpoints: 9,
weakness:'Earth',
picture: 'https://upload.wikimedia.org/wikipedia/commons/1/1c/Devil_cartoon_charactor.png',
}];
}),

// table: computed('model', function() {
// return Table.create(this.get('columns'), this.get('model'));
// return Table.create(this.get('columns'), this.get('model'));
//}),

init() {
    this._super(...arguments);

//I tried in the below ways
//let table = Table.create(this.get('columns'), this.get('model'));

    let table = Table.create(emberArray(makeArray(this.get('columns')))
    , emberArray(makeArray(this.get('model'))));

    // , { enableSync: this.get('enableSync') });
    this.set('table', table);
}    

});
``
this is my component file

@fran-worley
Copy link
Contributor

@surekha199 the create method expects an object so you need to pass in

{ columns: someArray, rows: someOtherArray }

@richard-viney
Copy link
Contributor

As @fran-worley mentioned, when using Table.create() you should pass an object with the relevant properties just like you would with any call to create a pre-Octane EmberObject:

const table = Table.create({
  columns: this.get("columns"),
  model: this.get("model")
});

this.set("table", table);

Also, the emberArray/makeArray there likely isn't needed, unless you've disabled the array prototype extensions in your app's config, or are making an addon.

@surekha199
Copy link

Thank you @fran-worley and @richard-viney ,

I tried both the options mentioned in your comments but I still see the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants