Sample extjs code for creating a proxy between a data store at client side and backend.
extjs 4.0.2a example..
======This should be overriden globally for use ===============
Ext.data.proxy.Rest.override({
actionMethods : {
create : 'POST',
read : 'GET',
update : 'POST',
destroy: 'POST'
}
});
===============================================================
var jsonReader = Ext.create('Ext.data.reader.Json',{
root: 'data',
totalProperty: 'total',
successProperty: 'success',
idProperty: 'stakeholderTypeId',
messageProperty: 'message'
},StakeholderType);
var jsonWriter = Ext.create('Ext.data.writer.Json',{
root: 'data',
encode: true,
writeAllFields: true
});
var proxy = Ext.create('Ext.data.proxy.Rest',{
api: {
read : 'stakeholderTypeView.htm',
update : 'stakeholderTypeEdit.htm',
destroy : 'stakeholderTypeDelete.htm'
},
reader : jsonReader,
writer : jsonWriter
});
======This should be overriden globally for use ===============
Ext.data.proxy.Rest.override({
actionMethods : {
create : 'POST',
read : 'GET',
update : 'POST',
destroy: 'POST'
}
});
===============================================================
var jsonReader = Ext.create('Ext.data.reader.Json',{
root: 'data',
totalProperty: 'total',
successProperty: 'success',
idProperty: 'stakeholderTypeId',
messageProperty: 'message'
},StakeholderType);
var jsonWriter = Ext.create('Ext.data.writer.Json',{
root: 'data',
encode: true,
writeAllFields: true
});
var proxy = Ext.create('Ext.data.proxy.Rest',{
api: {
read : 'stakeholderTypeView.htm',
update : 'stakeholderTypeEdit.htm',
destroy : 'stakeholderTypeDelete.htm'
},
reader : jsonReader,
writer : jsonWriter
});
Comments
Post a Comment