emberjs / list-view

An incremental rendering list view for Ember.js
MIT License
465 stars 116 forks source link

using different ListItemViews through itemViewForIndex() throws 'Uncaught TypeError: undefined is not a function' #233

Closed patuku closed 9 years ago

patuku commented 9 years ago

Hi,

I'm using Ember 1.11.0 and Ember-CLI 0.2.2

this is my view file:

import Ember from 'ember';
import ListView from 'ember-list-view';
import ListItemView from 'ember-list-view/list-item-view';

var win = Ember.$(window);
var w   = win.width();
var h   = win.height();

var ListViewOneLine     = ListView.extend({
    width               : w,
    height              : h,
    rowHeight           : 46,
    itemViews           : {
        "cat"           : ListItemView.extend({
            classNames      : ['cat'],
            rowHeight       : 46,
            templateName    : "activity-row"
        }),
        "dog"           : ListItemView.extend({
            classNames      : ['dog'],
            rowHeight       : 46,
            templateName    : "activity-row"
        }),
    },
    heightForIndex      : function(idx) {
        return this.itemViewForIndex(idx).proto().rowHeight;
    },
    itemViewForIndex    : function(idx) {
        return this.itemViews[this.get('content').objectAt(idx).type];
    }
});

export default ListViewOneLine;

I did the initial render, but when I scrolling the list I've got the following error:

error when scrolling

This is a bug or maybe I did it wrong? Any help would be appreciate :). Thanks in advance.

taras commented 9 years ago

Ember 1.11 has a regression, use 1.11.1

patuku commented 9 years ago

Hi @taras ... thanks for the clue ... it works :+1: :+1: :+1: