kathy_s
6 Dec 2011, 5:03 AM
Hi,
I'm trying to create a store that loads data in json format from a rest-webservice (written in egl).
When I create the XmlHttpRequest myself, the data is loaded into the grid, but the paging toolbar doesn't work. So now I'm trying to configure a proxy in my data store, but I can't get it working.
Can anybody show me how to create my XmlHttpRequest through a proxy? Or is their another way to solve this? I'm new to extjs so any tips are welcome!
var http = new XMLHttpRequest();
var data = '{"bindingName":"CleanUpFolderSrv","method":"getCleanUpFolders","params":[{"start":0,"limit":null,"SQLwhere":"' + getSearchCriteria() +'","sort":"FOLDERID","dir":"ASC"}]}';
var my_JSON_object = null;
http.open("POST", gs_url, false);
http = setRequestHeaders(http);
http.send(data);
if (http.readyState == 4 && http.status == 200){
my_JSON_object = Ext.decode(http.responseText);
}else{
//TODO
}
clFolderStore = Ext.create('Ext.data.Store', {
data: my_JSON_object.result.rows,
//totalProperty: my_JSON_object.result.results,
autoload: true,
fields: ['ACT', 'FOLDERID', 'OPERATINGSYSTEM', 'CONNECTION', 'CLEANUPFOLDER', 'DELETEFOLDER', 'CLEANUPSUBFOLDER', 'DELETESUBFOLDER', 'HOST', 'FOLDERPATH',
'FILEEXTENSIONS', 'FILEAGEINDAYS', 'DELETEFILESCANVALUE', 'INCUBATEFOLDER', 'COMMENTS' ]
});
//...
//in my datagrid:
bbar: Ext.create('Ext.toolbar.Paging', {
xtype: 'pagingtoolbar',
store: clFolderStore,
displayInfo: true,
pageSize: 25,
displayMsg: 'Displaying record(s) {0} - {1} of {2}',
emptyMsg: "No records to display",
plugins: [new Ext.ux.PageSizePlugin({editable:false, forceSelection:true})]
})
Thanks,
Kathy
I'm trying to create a store that loads data in json format from a rest-webservice (written in egl).
When I create the XmlHttpRequest myself, the data is loaded into the grid, but the paging toolbar doesn't work. So now I'm trying to configure a proxy in my data store, but I can't get it working.
Can anybody show me how to create my XmlHttpRequest through a proxy? Or is their another way to solve this? I'm new to extjs so any tips are welcome!
var http = new XMLHttpRequest();
var data = '{"bindingName":"CleanUpFolderSrv","method":"getCleanUpFolders","params":[{"start":0,"limit":null,"SQLwhere":"' + getSearchCriteria() +'","sort":"FOLDERID","dir":"ASC"}]}';
var my_JSON_object = null;
http.open("POST", gs_url, false);
http = setRequestHeaders(http);
http.send(data);
if (http.readyState == 4 && http.status == 200){
my_JSON_object = Ext.decode(http.responseText);
}else{
//TODO
}
clFolderStore = Ext.create('Ext.data.Store', {
data: my_JSON_object.result.rows,
//totalProperty: my_JSON_object.result.results,
autoload: true,
fields: ['ACT', 'FOLDERID', 'OPERATINGSYSTEM', 'CONNECTION', 'CLEANUPFOLDER', 'DELETEFOLDER', 'CLEANUPSUBFOLDER', 'DELETESUBFOLDER', 'HOST', 'FOLDERPATH',
'FILEEXTENSIONS', 'FILEAGEINDAYS', 'DELETEFILESCANVALUE', 'INCUBATEFOLDER', 'COMMENTS' ]
});
//...
//in my datagrid:
bbar: Ext.create('Ext.toolbar.Paging', {
xtype: 'pagingtoolbar',
store: clFolderStore,
displayInfo: true,
pageSize: 25,
displayMsg: 'Displaying record(s) {0} - {1} of {2}',
emptyMsg: "No records to display",
plugins: [new Ext.ux.PageSizePlugin({editable:false, forceSelection:true})]
})
Thanks,
Kathy