This is my first time using REST and I'm having a bit of trouble. I'm using EXTJS 5.1 and Parse.com. I have a table of listObjects and I only want to load the store with certain listObjects. Here is the parse REST API on what I'm trying to do http://ift.tt/1wdUu0b
Here is what I'm doing to manipulate the proxy URL:
This works, but I'd like to believe there is a more correct way to do this. Any suggestions?
How to correctly append value to REST proxy URL
Here is my store:
Code:
Ext.define('top10.store.ListObjectStore' , {
extend : ' Ext .data.Store' ,
require :[
'top10.model.ListObject'
],
model : 'top10.model.ListObject' ,
proxy : {
type : 'rest' ,
url : 'http://ift.tt/1EG2yWI' ,
useDefaultXhrHeader : false ,
withCredentials : false ,
headers : {
'X-Parse-Application-Id' : "xxx" ,
'X-Parse-REST-API-Key' : 'xxx' ,
'Content-Type' : 'application/json'
},
reader :{
type : 'json' ,
rootProperty : 'results' ,
transform: function ( data ) {
return data.results ? data.results : {results :data};
}
},
writer : {
type : 'json' ,
writeRecordId : false
}
}
});
Here is what I'm doing to manipulate the proxy URL:
Code:
onCmboListSelect: function (cmbo, rec){
var listStore = Ext .create('top10.store.ListObjectStore' );
listStore.proxy .url = listStore.proxy .url + '/?where={"listId": "' +rec.get('objectId' )+'"}' ;
listStore.load();
}
This works, but I'd like to believe there is a more correct way to do this. Any suggestions?
How to correctly append value to REST proxy URL
Aucun commentaire:
Enregistrer un commentaire