PDA

View Full Version : registered xtype is not accepting any items.



sencha_san
23 Sep 2011, 3:29 AM
Hi, i'm brand new to sencha touch and ExtJS. I need to develop collapsible panel.To do this i extended 'Panel' to include a button(with new...) and toolbar(with xtype) and registered with Ext.reg('xx',yy).

Next is created a panel with items including register xtype,upto this point it is working fine. When i tried with nesting of register xtype, [{ xtype:'xx',items:[xtype:'xx']}] it is not working.

One more problem with this collapsing panel is not scrolling up even after using " align:stretch".I posted the code below.

Where i'm missing the flow,please let me know.

Ext.ns('San');
San.panel=Ext.extend(Ext.Panel,
{
layout:
{
type:'vbox',
align:'stretch'
},
style:'background-color:#111;left:50px;border:1px solid;',
collapsed::false,
scroll:'vertical',
initComponent::function()
{
var me=this;
me.Button=new Ext.Button
({
text:'hi',
iconCls:'arrow_up',
iconMask:true,
handler:function(btn,e)
{
alert("Clicked!");
me.collapsed=!me.collapsed;
if(!me.collapsed)
{
alert("1");
btn.setIconClass('arrow_up');
//Ext.getCmp('main_panel').findParentByType("panel").doLayout(true);
//alert(Ext.getCmp('xx').hidden);
//me.setHeight(150);
//this.body.show();
//me.add(this.Mypanel);
//me.doComponentLayout();
}
else
{
alert("2");
btn.setIconClass('arrow_down');
//Ext.getCmp('san').add();
grid.up('main_panel');
Ext.getCmp('main_panel').findParentByType("panel").doLayout(true);

//me.setHeight(50);
//this.body.hide();
//me.remove(this.Mypanel);
//me.doComponentLayout();
}
},
scope:this,
hidden:false
});

Ext.apply(this,
{
layout:
{
type:'vbox',
align:'stretch'
},
items:
[{
xtype:'toolbar',
id:'panel2',
items:
[
{
xtype:'spacer'
},me.Button
]
}]
});


San.panel.superclass.initComponent.apply(this,arguments);
}


});


Ext.reg("SanPanel",San.panel);



Thanks in advance
San