PDA

View Full Version : ScriptTagProxy and JsonStore



flamant
13 Dec 2010, 10:53 AM
Hi,

I use a ScriptTagProxy for a jsonStore this way



var remoteGridProxy = new Ext.data.ScriptTagProxy({
api:{
read: { url : '../secure/getSubjectDataGrid.htm', method: 'POST' },
create: { url : '../secure/createSubjectDataGrid.htm', method: 'POST' },
update: { url : '../secure/updateSubjectDataGrid.htm', method: 'POST' },
destroy: { url : '../secure/deleteSubjectDataGrid.htm', method: 'POST' }
}
});


var remoteGridJsonStore = new Ext.data.JsonStore({
proxy: remoteGridProxy,
baseParams: { pageId: id, subjectId: subjectId, gridNum: gridNbr, sptNbr: (sptNbr+1), screenSequence: screenSequence },
storeId: 'remoteGridJsonStore_'+sptNbr+'_'+gridNbr,
root: 'records',
autoLoad: false,
totalProperty: 'totalCount',
remoteSort: false,
fields: gridFields,
I have two questions

1)Unhappily the requests are sent with a 'GET' method. So I didn't use the right syntax. How can I send them with a POST method

2) Furthermore some gridFields are not sent to the server. Maybe when the value has not changed the Ext.data.Field is not sent to the server ?How can I force the store to send every Ext.data.Field ?

Thank you in advance for your answers

mankz
13 Dec 2010, 1:30 PM
You cannot do a POST with such a proxy, remember - behind the scenes it's just a script tag added to the page.

flamant
14 Dec 2010, 5:34 AM
Hi mankz and thank you for your answer,

so how can I use read, update, create, destroy using a POST method ? Is there another way ?

flamant
15 Dec 2010, 1:21 AM
Hi,
the problem is that I send too many datas to the server (more than 6000 characters) and it gives me a 400 Bad request error. So I must use the POST method

Animal
15 Dec 2010, 1:25 AM
Then don't use ScriptTagProxy!

You don't need to, you are using a relative URL.

flamant
15 Dec 2010, 3:35 AM
Hi animal and thank you for your answer,

I tried this :



var remoteGridProxy = new Ext.data.HttpProxy({
api:{
read: { url : '../secure/getSubjectDataGrid.htm', method: 'GET' },
create: { url : '../secure/createSubjectDataGrid.htm', method: 'POST' },
update: { url : '../secure/updateSubjectDataGrid.htm', method: 'POST' },
destroy: { url : '../secure/deleteSubjectDataGrid.htm', method: 'POST' }
}
});


But it doesn't work

Could anyone can give me an example of what I should implement ?

I have at least to send the request for update and create with a POST method