// Search panel with two buttons
var searchPanel = new Ext.FormPanel({
frame:true,
title: 'Search Criteria',
collapsible:true,
defaultType: 'textfield',
region:'west',
autoScroll:true,
// has few text boxes for input search
],
buttons: [{
id: 'search-button',
text:'Search',
handler:applySearch
},{
id:'stop-button',
text:'Stop',
handler:stopSearch
}]
});
function applySearch(){
applySearchFunction('search');
}
function applySearchFunction() {
//calls the store with required fields
}
function stopSearch(){
//What adjustments need to be made here to abort/cancel the ongoing processing request.
}
var reader = new Ext.data.JsonReader({
id:'id'
,totalProperty:'total'
,root:'rows'
,fields:[
// required fields
]
});
function handleServerTimeOutError(conn, response, options) {
if(response.status == 504){
Ext.Msg.alert(
'Timed out',
'The search operation timed out, please try again'
);
}
}
// The backend call takes place here..
var connObj = new Ext.data.Connection({
timeout : toMS(60),
url : 'file containing json logic',
method : 'POST',
listeners: {
requestexception: handleServerTimeOutError
}
});
var store = new Ext.data.GroupingStore({
reader: reader,
//use proxy so we can set timeout
proxy : new Ext.data.HttpProxy(connObj),
//autoLoad: 'true',
remoteSort: true,
listeners: {
beforeload: startIdleTimer
}
});