I have a couple of questions about the url
field of an ajax
proxy, and Ext.Ajax.request
I'm getting a JSON response from an Ext.Ajax.request
, and sending that data to a store
. (I'm also trying to use the pagingToolbar
, which is highly uncooperative at the moment)
Anyhow, the paging only seems to slightly work when I use an ajax
proxy, however I'm not sure what to put in as the URL. Currently it's url: ''
var store = Ext.create('Ext.data.Store', {
storeId : 'resultsetstore',
autoLoad : false,
pageSize : itemsPerPage,
fields: [
{name : 'id', type : 'auto'},
{name : 'name', type : 'auto'},
{name : 'description', type : 'auto'}
],
proxy: {
type : 'ajax',
url : '???',
reader: {
type : 'json',
root : 'elements'
}
}
});
It seems the url
reads data from a .json
file in a specific directory (i.e. url: 'myData/data.json'
), but there isn't any file like that to read from, as my response
is coming back as a JSON Object.
And here is my request/response
, which I parse and send to my store
:
var request = Ext.Ajax.request({
url : 'MCApp', //here I specify the Servlet to be read from
jsonData : searchquery, //A JSON Object
params:{
start:0,
limit: itemsPerPage
},
success : function(response) {
mainresponse = response.responseText;
//etc.
}
Is having a separate request redundant?
Could I accomplish this within my store alone (passing my searchquery
as a parameter to the server and all that jazz)?
I apologize for this jumbled question in advance!
Cheers