PDA

View Full Version : Insert record into store



wdieujus
15 Jul 2013, 11:11 AM
Im facing an error inserting a record into a store.

Heres my model:

Ext.define('DicomgrConfig.model.Feeder', {
extend: 'Ext.data.Model',
fields: ['id', 'platform', 'market', 'server', 'port', 'user', 'pass', 'app', 'instrumentTypeFilter', 'dicoFilename', 'tickFilename', 'udlgFilename', 'straFilename', 'isActive']});

Heres my store:

Ext.define('DicomgrConfig.store.Feeders', {
extend: 'Ext.data.Store',
model: 'DicomgrConfig.model.Feeder',
autoLoad: true,
autoSync: true,
proxy: {
type: 'ajax',
api: {
read: 'app/scripts/readFeederConfig.php',
update: 'app/scripts/updateFeederConfig.php',
create: 'app/scripts/insertFeederConfig.php'
},
reader: {
type: 'json',
root: 'feeders',
successProperty: 'success'
}
}
});

Heres my controller:

addFeeder: function(button) {

var newFeeder = new this.getFeedersStore.recordType({id: "5", platform: "DCM", market: "BATS", server: "Bats server", port: "port", user: "User", pass: "pass", app: "app", instrumentTypeFilter: "type", dicoFilename: "spol_bats.dico", tickFilename: "spol_bats.tsr", udlgFilename: "", straFilename: "", isActive: "Y"});
this.getFeedersStore.add(newFeeder);

}

Im getting an "Object expected" error.

slemmon
16 Jul 2013, 10:11 PM
Try with just:



this.getFeedersStore.add({
id: "5",
platform: "DCM",
market: "BATS",
server: "Bats server",
port: "port",
user: "User",
pass: "pass",
app: "app",
instrumentTypeFilter: "type",
dicoFilename: "spol_bats.dico",
tickFilename: "spol_bats.tsr",
udlgFilename: "",
straFilename: "",
isActive: "Y"
});