bomslang
4 Sep 2012, 10:18 AM
Folks,
I am trying to bind my model with store using REST proxy as shown here
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Model
Here's my code inside launch( ) function :-
launch: function() {
Ext.define('Record', {
extend: 'Ext.data.Model',
fields: [{name: 'id', type:'int'}, {name:'content', type:'string'} ,{name: 'name', type:'string'} ,{name:'title', type:'string'}],
proxy: {
type: 'rest',
api: {
read : 'feedback/read.action',
create : 'feedback/new.action',
update: 'feedback/update.action',
destroy: 'feedback/delete.action'
},
reader: {
type: 'json',
root: 'data',
totalProperty: 'total',
successProperty: 'success',
idProperty: 'id'
},
writer: {
type: 'json',
encode: true,
writeAllFields: true
}
}
});
var record = Ext.create('Record', {content:'ABC', name: 'XYZ', title: 'Title Text'});
var store = new Ext.data.Store({
model: record,
autoSave: false,
autoLoad: true
});
But it throws me below errors saying
Uncaught TypeError: Cannot read property 'fields' of undefined
38465
I am trying to bind my model with store using REST proxy as shown here
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Model
Here's my code inside launch( ) function :-
launch: function() {
Ext.define('Record', {
extend: 'Ext.data.Model',
fields: [{name: 'id', type:'int'}, {name:'content', type:'string'} ,{name: 'name', type:'string'} ,{name:'title', type:'string'}],
proxy: {
type: 'rest',
api: {
read : 'feedback/read.action',
create : 'feedback/new.action',
update: 'feedback/update.action',
destroy: 'feedback/delete.action'
},
reader: {
type: 'json',
root: 'data',
totalProperty: 'total',
successProperty: 'success',
idProperty: 'id'
},
writer: {
type: 'json',
encode: true,
writeAllFields: true
}
}
});
var record = Ext.create('Record', {content:'ABC', name: 'XYZ', title: 'Title Text'});
var store = new Ext.data.Store({
model: record,
autoSave: false,
autoLoad: true
});
But it throws me below errors saying
Uncaught TypeError: Cannot read property 'fields' of undefined
38465