PDA

View Full Version : Issue with HttpProxy for Grid



mahesh_yamsani
28 Dec 2010, 9:51 PM
Hi,

I am a beginner for Ext-Js, I have a problem when I am trying to save all the records in grid,

Proxy Code

var proxy = new Ext.data.HttpProxy({
api: {
read : 'http://localhost:8080/test/lookup/lookupTerritory/data.json',
create : {
url:'http://localhost:8080/test/lookup/lookupTerritory/create.json',
method:'post'
}
}
});My Reador is


var Area = Ext.data.Record.create([
{name: 'areaName'},
{
name: 'areaName',
type: 'string'
}, {
name: 'areaType',
type: 'string'
},{
name: 'areaId',
type: 'int'
}]);
var reader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
root: 'data'

},
Area);Writer code

var writer = new Ext.data.JsonWriter({
encode: true,
writeAllFields: true
});Data Store is


var ds=new Ext.data.Store( {
proxy:proxy,
reader:reader,
writer: writer, // <-- plug a DataWriter into the store just as you would a Reader
autoSave: false
});

ds.load();Save event method is


buttons: [{
text: 'Save All Data',
handler: function(){
ds.save();
}
}]
the problem is , when I click on My Save All Data method the frame should be capable to attach the rowdata(s) as a request parameter , but my application is not able to send the rowdata(s) as a request Parameter.

Can any one help in resolving this ASAP.

Thank you in Advance

mankz
28 Dec 2010, 11:38 PM
Your API definition for your proxy only specifies read and create, by 'Saving' do you mean 'Creating'? If not you should add an 'update' command for your proxy API too.