PDA

View Full Version : Adding to Store



Cleer
28 Jun 2010, 11:03 PM
I'm trying to add a record to a store.

My code for the handler for a button goes something like this:


...
var course = Ext.ModelMgr.create({
id_pre: id_pre,
id_suf: id_suf,
name: name,
units: units,
grade: grade
}, 'Course');
courses.store.insert(0, course);

Other relevant code (container at the top of a separate file, in case that is relevant):


Ext.ns('courses');

Ext.regModel('Course', {
fields: [
{name: 'id_pre', type: 'string'},
{name: 'id_suf', type: 'string'},
{name: 'name', type: 'string'},
{name: 'units', type: 'int'},
{name: 'grade', type: 'string'}
]
});

courses.store = new Ext.data.Store({
model: 'Course',
sorters: 'id_pre',

getGroupString: function(record) {
return getDepartment(record.get('id_pre'));
}
});

I'm getting this error:

TypeError: Result of expression 'this.itemTpl' [undefined] is not an object.

on ext-touch-debug.js:14638

I debugged some of the other errors I was getting, but I'm completely stumped on this one. Any ideas here?