Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying out a simple List example on Sencha Touch 2, I get "Uncaught TypeError"

I'm trying out Sencha 2, I can get a nested list to display correctly taking an example from the tutorials, but as soon as I try a simple list variant I get the following error: Uncaught TypeError: Expecting a function in instanceof check, but got #Object

I'm using the exact same code as in the example, with just a change to fit the code in its own file:

Ext.define('layouts.view.TheList', {
  extend: 'Ext.List',
  xtype: 'thelist',

  config: {
    title: 'The List',

    store: {
      fields: ['name'],
      data: [
        {name: 'Cowper'},
        {name: 'Everett'},
        {name: 'University'},
        {name: 'Forest'}
      ]
    },

    itemTpl: '{name}'

  }
});
like image 212
kaore Avatar asked Mar 11 '12 20:03

kaore


2 Answers

I had the same error. It worked properly when i added the following code

requires: [
    'Ext.dataview.List',
    'Ext.data.Store',
],

before the 'config:' block.

like image 134
manojtc Avatar answered Nov 09 '22 03:11

manojtc


I'm facing issues with some of my lists, only displaying the content if I set a height value, I don't know what causes this problem yet.

Ext.define('ZF.view.wall.Foo', {
  extend: 'Ext.List',
  xtype: 'thelist',

  config: {
   title: 'The List',
   height: 600,

  store: {
   fields: ['name'],
   data: [
    {name: 'Cowper'},
    {name: 'Everett'},
    {name: 'University'},
    {name: 'Forest'}
   ]
  },

itemTpl: '{name}'
}
});
like image 2
sgimeno Avatar answered Nov 09 '22 04:11

sgimeno