I have defined:
/app/model/Todo:
Ext.define('Test.model.Todo', {
extend: 'Ext.data.Model',
config: {
fields: [
{ name: 'title', type: 'string' },
{ name: 'priority', type: 'integer', defaultValue: 0 },
{ name: 'done', type: 'boolean' }
]
}
});
/app/store/TodoStore
Ext.define('Test.store.TodoStore', {
extend: 'Ext.data.Store',
requires: [ 'Test.model.Todo' ],
config: {
model: 'Test.model.Todo',
data: [
{ title: 'Todo Item 1', priority: 0, done: false },
{ title: 'Todo Item 2', priority: 0, done: false },
{ title: 'Todo Item 3', priority: 0, done: false },
{ title: 'Todo Item 4', priority: 0, done: false },
{ title: 'Todo Item 5', priority: 0, done: false },
{ title: 'Todo Item 6', priority: 0, done: false }
]
}
});
Now, if I just use store: 'TodoStore'
in a list, I get
[WARN][Ext.dataview.List#applyStore] The specified Store cannot be found
So I added too app.js
Ext.application({
name: 'Test',
...
stores: [ 'TodoStore' ],
The warning goes away, but I still have a blank list. Am I missing something?
Old Post below
Ext.define("SimpleTodo.view.Main", {
extend: 'Ext.Panel',
requires: [ 'Ext.TitleBar', 'Ext.dataview.List' ],
config: {
styleHtmlContent: true,
items: [
...
{
xtype: 'list',
itemTpl: '{name}',
store: {
fields: ['name'],
data: [
{ name: 'Todo 1' },
{ name: 'Todo 2' },
{ name: 'Todo 3' },
{ name: 'Todo 4' },
{ name: 'Todo 5' },
{ name: 'Todo 6' }
]
}
}
]
}
});
Getting:
Expecting a function in instanceof check, but got
#<Object>