No rows rendered by embertable but colums show up

442 Views Asked by At

I am using the newest ember and embertable. Tried to use example from the page and rewrite it for use in my MVC project. Problem is that rows will not show but the columns show.

Is this a problem with the new ember version?

Edit: Putting som more information here.

HTML

            <script type="text/x-handlebars" data-template-name="application">
          <div class='presentation-container'>
            {{view Ember.Table.TablesContainer controllerBinding="tableController"}}
          </div>
        </script>

The output(No rows =/ )

Date Entry Low Open Volume High Close

EmployeetaskController

App.EmployeetasksController = Ember.Controller.extend({
    tableController: Ember.computed(function () {
        return Ember.get('App.EmployeetasksController.TableController').create();
    }).property() });

App.EmployeetasksController.LazyDataSource = Ember.ArrayProxy.extend({
    init: function () {
        console.log('EmployeetasksController.LazyDataSource init');
      enter code here  this._super();
    },
    objectAt: function (idx) {
        console.log("Lager rad");
        var date, row;
        row = this.get('content')[idx];
        if (row) {
            return row;
        }
        date = new Date();
        date.setDate(date.getDate() + idx);
        row = {
            index: idx,
            date: date,
            open: Math.random() * 100 - 50,
            high: Math.random() * 100 - 50,
            low: Math.random() * 100 - 50,
            close: Math.random() * 100 - 50,
            volume: Math.random() * 1000000
        };
        this.get('content')[idx] = row;
        return row;
    }, });

App.EmployeetasksController.TableController = Ember.Table.TableController.extend({
    init: function () {
        console.log('EmployeetasksController.TableController init');
        this._super();
    },
    hasHeader: true,
    hasFooter: true,
    numFixedColumns: 0,
    numRows: 500000,
    rowHeight: 30,
    columns: Ember.computed(function () {
        var columnNames, columns, dateColumn, entryColumn;
        columnNames = ['open', 'high', 'low', 'close', 'volume'];
        entryColumn = Ember.Table.ColumnDefinition.create({
            columnWidth: 100,
            headerCellName: 'Entry',
            contentPath: 'index'
        });
        dateColumn = Ember.Table.ColumnDefinition.create({
            columnWidth: 150,
            headerCellName: 'Date',
            getCellContent: function (row) {
                return row['date'].toDateString();
            }
        });
        columns = columnNames.map(function (key, index) {
            var name;
            name = key.charAt(0).toUpperCase() + key.slice(1);
            return Ember.Table.ColumnDefinition.create({
                columnWidth: 100,
                headerCellName: name,
                getCellContent: function (row) {
                    return row[key].toFixed(2);
                }
            });
        });
        columns.unshift(dateColumn);
        columns.unshift(entryColumn);
        return columns;
    }).property(),
    content: Ember.computed(function () {
        console.log("Lager array");
        return App.EmployeetasksController.LazyDataSource.create({
            content: new Array(this.get('numRows'))
        });
    }).property('numRows') });

The view

App.EmployeetasksView = Ember.View.extend({
    classNames: 'ember-app',
    templateName: 'employeetasks'
});
1

There are 1 best solutions below

0
On

Outdated ember and handlebars fixed it.