没有由embelable呈现的行但列显示

时间:2013-03-06 10:23:08

标签: model-view-controller ember.js ember-table

我正在使用最新的余烬和可嵌入。试图从页面中使用示例并重写它以便在我的MVC项目中使用。问题是行不会显示但列显示。

这是新版本的ember版本的问题吗?

编辑:在这里提供更多信息。

HTML

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

输出(无行= /)

  

日期输入低开仓量高收盘

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') });

视图

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

1 个答案:

答案 0 :(得分:0)

过时的余烬和把手修好了它。