Code:
Ext.onReady(function(){
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.QuickTips.init();
var myviewport = new Ext.Viewport({
layout: 'border',
id: 'fullport',
items: [
{
region: 'east',
title: 'Ads This Page',
contentEl: 'east',
split: true,
width: 175,
minSize: 175,
maxSize: 175,
collapsible: true,
//autoScroll: true,
margins: '0 0 0 0'
},
{
xtype: 'panel',
region: 'west',
//title: 'Please Login',
id: 'west-panel',
width: 250,
minSize: 20,
maxSize: 400,
autoScroll: true,
collapsible: true,
layout: 'fit',
split: 'true',
items:
new Ext.TabPanel({
border: false,
activeTab: 0,
defaults:{autoScroll:true,border:false},
items:[
{
title: 'Contents',
contentEl: 'contentstab',
iconCls: 'navtab'
},
{
title: 'Search',
contentEl: 'searchtab',
iconCls: 'searchtab'
},
{
title: 'Weather',
contentEl: 'weathertab',
iconCls: 'weathertab'
}
]
})
},
{
xtype: 'panel',
region: 'center',
margins: '0 0 0 0',
contentEl: 'centerregion',
id: 'c-centerregion',
listeners: {
resize : function(){
/*console.log(arguments); */
resizeshowpage(this.getWidth(),this.getHeight());
newimgwidth = this.getWidth();
newimgheight = this.getHeight();
}
}
}
]
});
// get current pubdate
var currentpubdate = document.getElementById("statusdate").value;
var tree = new Ext.tree.TreePanel({
renderTo: 'tree-div', // div is defined in html source below
id: 'contentstree',
layout: 'fit',
animate: true,
rootVisible: true,
frame: false,
root: {
nodeType: 'async',
text: 'Pubdate'
},
dataUrl: 'tree/check-nodes.php?pd='+currentpubdate,
listeners: {
'render': function(tp){
tp.getSelectionModel().on('selectionchange',function(tree, node){
//var el = Ext.getCmp('details-panel').body;
showpagesrc = node.attributes.filename;
if (showpagesrc != undefined)
{
showpagesrc = node.attributes.filename;
}
// display the page that was clicked on
resizeshowpage(newimgwidth,newimgheight)
})
}
}
});
tree.getRootNode().expand(true);
//Ext.getCmp('contentstree').root.expand();
Ext.get("reloadtree").on('click',function(){
currentpubdate = document.getElementById("statusdate").value;
tree.getLoader().dataUrl = 'tree/check-nodes.php?pd='+currentpubdate;
tree.root.reload();
tree.getRootNode().expand(true);
});
<div id="contentstab" class="x-hide-display">
<div id="tree-div"></div>
</div>