PDA

View Full Version : Ext.History and some advice



John Sourcer
15 Aug 2009, 6:59 AM
Hi All,

Bit stuck here and am looking for some pointers. I have a basic site menu as follows:

Page1
Page2
Page3

The menu clicks call a js function loadPage(id) which load panel as follows:


function loadPage(id) {

Ext.History.add('loadPage:' + id);

//do page loading stuff

}

The history is accessed as follows:




Ext.History.on('change', function(token){
if(token){
var parts = token.split(':');
var name = parts[0];
var args= parts[1];

if (name!= undefined){ //deals with default instance still to patch
window[name](args);
}
}
});



And all would be well if...I was accessing the 2nd last item in the history as the last item is the one I am currently on so back just reloads the same page. I tried making it history(-2) in debug for a test but that doesn't help either. Is there a way to access the 2nd last item via Ext.History? Any idea's would be appreciate, this fixes back button for my app globally.

Thanks