PDA

View Full Version : How to handling the RowEditing update button?



RedWhale
18 Apr 2012, 5:58 AM
Hi, I can speak a little english.
I have a question.

I want to handling RowEditing component "Update" button.
if i click the "Update" button, then "proxy" params set, pass my server. i want it.

My model proxy type "ajax" set, but why "rest" pass my server?

plz help me.......




‚Äč/** my model.. */
Ext.define('WFM.model.ContentModel', {
extend: 'Ext.data.Model',
proxy: {
type: 'ajax',
api: {
read: 'ContentAction',
create: 'ContentAction?mode=create',
update: 'ContentAction?mode=update',
destroy: 'ContentAction?mode=remove'
},
reader: {
type: 'json'
//root: 'users'
},
writer: {
type: 'json'
}
},
fields: [
{name: 'name', type: 'string'},
{name: 'memo', type: 'string'},
{name: 'date', type: 'string'},
{name: 'type', type: 'string'},
{name: 'size', type: 'string'},
{name: 'owner', type: 'string'}
]

});


3418034181

scottmartin
18 Apr 2012, 7:35 AM
You will need to create a custom writer to perform this. Something like:

This example will pass the fields as params:



writer: {
type: 'json',
writeRecords:function(request, data){
Ext.apply(data[0],request.params);
request.jsonData = Ext.urlEncode(data[0]);
return request;
}
}


Regards,
Scott

RedWhale
18 Apr 2012, 8:02 AM
Thank you, Scott !!!!!!
very nice !

It's my solution !


writer: {
type: 'json',
writeRecords:function(request, data){
request.params = data[0];
//console.log(request);
return request;
}
}





You will need to create a custom writer to perform this. Something like:

This example will pass the fields as params:



writer: {
type: 'json',
writeRecords:function(request, data){
Ext.apply(data[0],request.params);
request.jsonData = Ext.urlEncode(data[0]);
return request;
}
}


Regards,
Scott