В учебнике вы следующий старый стиль, и я предлагаю вам следовать этому tutorial.
же приложение, что, по которой вы не MVC и Tutorial я совместно следует MVC, я последовал за этот урок, когда я начал Сенча сенсорный.
Это приложение будет хорошим началом для вас. Также я хочу упомянуть, что это приложение просто не идеальное.
Как вы узнаете больше, вы познакомитесь с лучшей практикой.
Сказав, что позволяет решить WARNING в старом коде
Вы только что определили в магазин, но NotesStore не создана и зарегистрирована в Store Manager
Ext.regStore(id,config) будет делать это для вас, Попробуйте этот код.
Ext.application({
name : ('SF' || 'SenchaFiddle'),
launch : function() {
Ext.define('Notes', {
extend: 'Ext.data.Model',
id: 'modelId',
config: {
fields: [
{ name: 'id', type: 'int' },
{ name: 'date', type: 'date', dateFormat: 'c' },
{ name: 'title', type: 'string' },
{ name: 'narrative', type: 'string' }
],
validations: [
{ type: 'presence', field: 'id' },
{ type: 'presence', field: 'title' }
]
}
});
Ext.regStore('NotesStore', {
require: 'Ext.data.Store',
model: 'Notes',
storeId : 'NotesStore',
sorters: [{
property: 'date',
direction: 'DESC'
}],
proxy: {
type: 'localstorage',
id: 'notes-app-store'
},
// TODO: remove this data after testing.
data: [
{ id: 1, date: new Date(), title: 'Test Note', narrative: 'This is simply a test note' }
]
});
Ext.Viewport.add({
xtype: 'panel',
fullscreen: true,
layout: 'card',
html: "hello",
items: [{
xtype: 'panel',
id: 'notesListContainer',
layout: 'fit',
html: 'This is the notes list container',
items: [{
xtype: 'toolbar',
docked: 'top',
id: 'notesListToolbar',
title: 'My Notes'
},
{
xtype: 'list',
id: 'notesList',
//require: ['Notes.model.Notes','NotesApp.store.NotesStore'],
store: 'NotesStore',
itemTpl: '<div class="list-item-title">{title}</div>' +
'<div class="list-item-narrative">{narrative}</div>'
}]
}]
});
}
});
Вам необходимо определить 'storeId' свойство для своего магазина и опишите его для своего списка. Это нужно делать. – GenieWanted