PDA

View Full Version : Hide Accrodion item



joefox
28 Jul 2009, 9:58 AM
Hide Accrodion item

I know how to do this for a tabstripitem, but not a accrodion item any ideas?

I took a look at the documentation for AccordionLayout, and didnt see this option....
Thanks,

28 Jul 2009, 10:16 AM
? have you tried panel.hide?

joefox
28 Jul 2009, 10:18 AM
? have you tried panel.hide?

I dont want to hide the entire panel, just some items that are in it.



var accord_mainmenu = Ext.getCmp('west-panel');
accord_mainmenu.hide(1);

28 Jul 2009, 10:19 AM
yeah dude - accordion items are panels (or descendants)

joefox
28 Jul 2009, 10:21 AM
yeah dude - accordion items are panels (or descendants)

I tried this, but didnt work.



var accord_mainmenu = Ext.getCmp('west-panel');
accord_mainmenu.hideItem(1);


Where can i look to see what the call is for hidding a descendant? I look at accordion in the API documentation but i think i was looking in wrong spot.

joefox
28 Jul 2009, 11:33 AM
Strange I tried panel.hideTabItem(1) and still dosent work, what am i doing wrong?

joefox
28 Jul 2009, 1:55 PM
anyone?

mjlecomte
28 Jul 2009, 2:05 PM
Do yourself a favor an post code, use the examples as your base and you'll get along much better.
For example I modified the accordion demo as so:


<html>
<head>
<title>Accordion Layout</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css"/>

<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<!-- ENDLIBS -->

<script type="text/javascript" src="../../ext-all.js"></script>

<style type="text/css">
html, body {
font: normal 12px verdana;
margin: 0;
padding: 0;
border: 0 none;
overflow: hidden;
height: 100%;
}
.empty .x-panel-body {
padding-top:20px;
text-align:center;
font-style:italic;
color: gray;
font-size:11px;
}
</style>
<script type="text/javascript">
Ext.onReady(function() {

var item1 = new Ext.Panel({
title: 'Accordion Item 1',
html: '&lt;empty panel&gt;',
cls:'empty'
});

item2 = new Ext.Panel({
title: 'Accordion Item 2',
html: '&lt;empty panel&gt;',
cls:'empty'
});

var item3 = new Ext.Panel({
title: 'Accordion Item 3',
html: '&lt;empty panel&gt;',
cls:'empty'
});

var item4 = new Ext.Panel({
title: 'Accordion Item 4',
html: '&lt;empty panel&gt;',
cls:'empty'
});

var item5 = new Ext.Panel({
title: 'Accordion Item 5',
html: '&lt;empty panel&gt;',
cls:'empty'
});

accordion = new Ext.Panel({
region:'west',
margins:'5 0 5 5',
split:true,
width: 210,
layout:'accordion',
items: [item1, item2, item3, item4, item5]
});

var viewport = new Ext.Viewport({
layout:'border',
items:[
accordion, {
region:'center',
margins:'5 5 5 0',
cls:'empty',
bodyStyle:'background:#f1f1f1',
html:'<br/><br/>&lt;empty center panel&gt;'
}]
});
});
</script>
</head>
<body>
<script type="text/javascript" src="../shared/examples.js"></script><!-- EXAMPLES -->
</body>
</html>

mjlecomte
28 Jul 2009, 2:06 PM
I purposely made two of the variables global there, so you can then open firebug console and put this in and test:



item2.hide();
accordion.doLayout();

steffenk
28 Jul 2009, 2:23 PM
that works! Important is to do doLayout() to make the change visible.

joefox
28 Jul 2009, 2:41 PM
this is what i have now... i hought i can just do what you mentioned above, but i see its a completly different approach then what i do it here.


{
region:'west',
id:'west-panel',
title:'Main Menu',
split:true,
width: 200,
minSize: 200,
maxSize: 200,
collapsible: true,
margins:'5 0 0 0',
layout:'accordion',
layoutConfig:{
animate:true
},
defaults:{
collapsed:true
},
items: [{
contentEl: 'avail_rosters',
title:'My Roster',
border:false,
autoScroll:true, // Allow Scrolling
listeners: {expand : teacterexpandedyears},
iconCls:'group'
},{
contentEl: 'admin_portal',
title:'Admin Portal',
border:false,
autoScroll:true, // Allow Scrolling
listeners: {expand : adminportalexpanded},
iconCls:'user'
},{
contentEl: 'spec_portal',
title:'Spec Portal',
border:false,
autoScroll:true, // Allow Scrolling
listeners: {expand : specportalexpanded},
iconCls:'user'
},{
contentEl: 'userinformation',
title:'Your Account',
border:false,
autoScroll:true, // Allow Scrolling
iconCls:'nav'
}]
}

steffenk
28 Jul 2009, 2:45 PM
just give the items of accordion an id, and you're done:


Ext.getCmp('idOfPanel').hide();
Ext.getCmp('west-panel').doLayout();

joefox
29 Jul 2009, 4:53 AM
what is the unhide command?

mjlecomte
29 Jul 2009, 5:08 AM
show?

joefox
29 Jul 2009, 5:44 AM
unhide / show yes. sorry

joefox
29 Jul 2009, 6:40 AM
nevermind figured it out

Ext,getCmp('idOfPanel').show();
Ext,getCmp('west-panel').doLayout();