I need to create Twitter Bootstrap basic NavBar component in my ExtJS 4.2 application. All I want to make my component generate the following html:
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<ul class="nav">
<li class="active"><a href="#"><i class="icon1"></i> Item #1</a></li>
<li><a href="#"><i class="icon2"></i> Item #3</a></li>
<li><a href="#"><i class="icon3"></i> Item #3</a></li>
</ul>
</div>
</div>
I've created two views (NavBar and NavBarItem correspondingly):
Ext.define('My.view.layout.Navbar', {
extend: 'Ext.container.Container',
xtype: 'navbar',
cls: 'navbar navbar-inverse navbar-fixed-top',
defaultType: 'navbaritem',
initComponent: function() {
Ext.apply(this, {
items: [
{
title: 'Item #1',
icon: 'icon1',
selected: true
},
{
title: 'Item #2',
icon: 'icon2'
},
{
title: 'Item #3',
icon: 'icon3'
}
]
});
this.callParent(arguments);
}
});
Ext.define('My.view.layout.NavbarItem', {
extend: 'Ext.Component',
xtype: 'navbaritem',
autoEl: { tag: 'li' },
config: {
title: '',
icon: null,
selected: false
},
renderTpl: '<a href="#">{icon}{title}</a>',
initComponent: function() {
....
this.callParent(arguments);
}
});
I get something like this as an output:
<div class="navbar navbar-inverse navbar-fixed-top">
<li class="active"><a href="#"><i class="icon1"></i> Item #1</a></li>
<li><a href="#"><i class="icon2"></i> Item #3</a></li>
<li><a href="#"><i class="icon3"></i> Item #3</a></li>
</div>
How can I modify my NavBar view in order it could have a custom template and children components could be added to a particular element?