模型视图控制器-不显示由embertable渲染的行,但显示列



我用的是最新的ember和embertable。试图从页面使用的例子,并重写它在我的MVC项目中使用。问题是行不显示,但列显示。

这是新ember版本的问题吗?

编辑:把更多的信息放在这里。

HTML

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

输出(No rows =/)

日期输入低开量高关

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

过时的余烬和车把修复了它

相关内容

  • 没有找到相关文章

最新更新