PDA

View Full Version : hold selected state in a Viewport ?



Falcula
7 Dec 2007, 6:56 AM
Hello all,

Iam kinda crappy on javascript so i need some help.

I have two treeviews in the menu and they postback and then i loosing selected content state.
Any idea how i can hold the state after postback, is there any cookie/session solution avalible ?

Or can i set it manuel ?
See code below...


items:
[{
contentEl: 'west',
title:'<b>Websidor</b>',
border:false,
},{
contentEl: 'westor',
title:'<b>Produkter</b>',
border:false,
iconCls:'settings'
}]

<div id="west">
<Control:SubMenuWebpages ID="SubMenu" runat="server" />
</div>

<div id="westor">
<Control:SubMenuProducts ID="SubMenuProducts" runat="server" />
</div>

The comple script

<script type="text/javascript">
Ext.onReady(function(){

Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

var viewport = new Ext.Viewport({
layout:'border',
items:[
new Ext.BoxComponent({ // raw
region:'north',
el: 'north',
height:75
}),{
region:'south',
contentEl: 'south',
split:true,
height: 100,
minSize: 100,
maxSize: 200,
collapsible: true,
title:'Systeminformation',
margins:'0 0 0 0'
}, {
region:'east',
title: 'Detaljerad information',
collapsible: true,
split:false,
width: 225,
minSize: 175,
maxSize: 400,
layout:'fit',
margins:'0 5 0 0',
items:
new Ext.TabPanel({
border:false,
activeTab:0,
tabPosition:'top',
items:[{
html:'',
title: '<%=PageName %>',
autoScroll:true
}
]
})
},{
region:'west',
id:'west-panel',
title:'Meny',
split:true,
width: 200,
minSize: 175,
maxSize: 400,
collapsible: true,
margins:'0 0 0 5',
layout:'accordion',
layoutConfig:{
animate:true
},
items: [{
contentEl: 'west',
title:'<b>Websidor</b>',
border:false,
iconCls:'nav'
},{
contentEl: 'westor',
title:'<b>Produkter</b>',
border:false,
iconCls:'settings'
}]
},
new Ext.TabPanel({
region:'center',
deferredRender:false,
activeTab:0,
items:[{
contentEl:'center1',
title: '<%=PageName%>',
closable:true,
autoScroll:true
},{
contentEl:'center2',
title: 'Center Panel',
autoScroll:true
}]
})
]
});
});

</script>