The left TabBar and senchatabbar of Sencha Touch 1.x TabPanel

Source: Internet
Author: User

The left TabBar and senchatabbar of Sencha Touch 1.x TabPanel
First look at the effect

Actually, problems may occur.

In sencha touch, tabBar can be displayed normally only when it is set on or below.

If it is set to the left side, the following result is generated by default:

To solve this problem, my first reaction is to use css. But that undoubtedly increases complexity. (I did that too, so it's so troublesome)

In fact, as long as you are familiar with the layout of sencha touch, you can easily find the key to the problem.

Tab1, Tab2, and Tab3 buttons in a horizontal row. What is this? Isn't that the hbox layout!

OK, that is, to make it vertical, you only need to change the hbox layout to the vbox layout.

First measure

Because Tab1, Tab2, and Tab3 are in TabBar, we change layout of tabBar to vbox.

The Code is as follows:

tabBar : {
layout: 'vbox',
dock: 'left'
}

No effect was found. After a while, I found that the following statements work:

tabBar : {
layout: {
type: 'vbox'
},
dock: 'left'
}

Why... I don't understand.

In this way, the running effect is like this:

Improved beautification

It's hard to see them together. So I tried to configure margin. I tried to use the css syntax to match margin.

Surprise. You can configure the margin in each direction separately.

tabBar : {
layout: {
type: 'vbox'
},
defaults: {
margin: '10 0 0 0',
},
dock: 'left'
}

Therefore, the final result is obtained. That is what we see at the beginning.

The complete code is as follows:

Ext.setup({
onReady: function() {
new Ext.TabPanel({
fullscreen: true,
type: 'dark',
tabBar : {
layout: {
type: 'vbox'
},
defaults: {
margin: '10 0 0 0',
},
dock: 'left'
},
sortable: true,
items: [{
title: 'Tab 1',
html: '1',
cls: 'card1'
}, {
title: 'Tab 2',
html: '2',
cls: 'card2'
}, {
title: 'Tab 3',
html: '3',
cls: 'card3'
}]
});
}
});

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.