PDA

View Full Version : store.recordType is not a constructor



crocop21
24 May 2012, 6:33 AM
Hi i am trying to add a new record to my grid and save this, with a event click
But i have some error:
store.recordType is not a constructor


chrome://firebug/content/blank.gif

var person = new store.recordType(defaultData,id);



This is my function:

var gridd = Ext.getCmp('p');
var store = gridd.getStore();
var position = store.getCount();
var id = Ext.id();
var defaultData = {
name : "",
age : "",
country : ""
};
gridd.stopEditing();
var person = new store.recordType(defaultData,id);
store.insert(position, person);
gridd.startEditing(position, 1);

scottmartin
24 May 2012, 3:00 PM
Have a look at the writer example: /examples/writer/writer.js



Ext.define('Writer.Person', {
extend: 'Ext.data.Model',
..
});

onAddClick: function(){
var rec = new Writer.Person({ // model
first: '',
last: '',
email: ''
}), edit = this.editing;

edit.cancelEdit();
this.store.insert(0, rec);
edit.startEditByPosition({
row: 0,
column: 1
});
}


Regards,
Scott.

vietits
24 May 2012, 5:53 PM
Try this:


var gridd = Ext.getCmp('p');
var store = gridd.getStore();
var position = store.getCount();
//var id = Ext.id();
//var defaultData = {
var person = {
id: Ext.id(),
name : "",
age : "",
country : ""
};
gridd.stopEditing();
//var person = new store.recordType(defaultData,id);
store.insert(position, person);
gridd.startEditing(position, 1);