Hello everyone,
For a while now I've been using Ext3.0, but today I've struggled with an call to JsonStore.recordType() returning undefined.
The code where the error occurs. Here record becomes undefined and the store.add throws an 'record[i]' is undifined in firebug
Code:
Ext.Msg.prompt('Naam', 'Geef een nieuwe naam voor de denominatie op:', function(btn, text) {
if (text != '') {
record = this.items.get(0).store.recordType({
name: text
});
this.items.get(0).store.add(record);
}
}, this);
The store:
Code:
store.DenominationStore = Ext.extend(store.BaseStore, {
constructor: function(config) {
store.DenominationStore.superclass.constructor.call(this, Ext.apply({
fields: [{
name: 'id'
},{
name: 'name'
}],
url: 'php/ajax/denominations.php'
}, config));
}
});
store.BaseStore = Ext.extend(Ext.data.JsonStore, {
constructor: function(config) {
store.BaseStore.superclass.constructor.call(this, Ext.apply({
autoLoad: true,
autoSave: true,
autoDestroy: true,
batch: false,
idProperty: 'id',
totalProperty: 'totalCount',
remoteSort: true,
listeners: {
'exception' : function(proxy, type, action, options, response, arg) {
if (type == 'response') {
json = Ext.decode(response.responseText);
error.actionCanceled(json.reason);
} else if (type == 'remote') {
error.actionCanceled(response.reason);
} else {
error.unknownError();
}
}
},
root: 'data',
writer: new Ext.data.JsonWriter({
encode: true,
writeAllFields: true
})
}, config));
}
});
If anyone has any pointers, I'd appreciate that!
I'm new btw, so please forgive me if i missed something obvious i should hav added.
greetz,
Flanders