Sencha Touch - Layout Card



Description

Card − This layout arranges different components in tab fashion. Tabs will be displayed on top of the container. Every time only one tab is visible and each tab is considered as a different component.

Syntax

Following is the simple syntax to use card layout.

layout: 'card' 

Example

Following is a simple example showing the usage of card layout.

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.application({
            name: 'Sencha', launch: function() {
               var panel = Ext.create('Ext.Panel', {
                  layout: 'card', items: [
                     {
                        html: "First Item index value is 0"
                     },
                     {
                        html: "Second Item index value is 1 which we are setting as active index"
                     },
                     {
                        html: "Third Item index value is 2"
                     },
                     {
                        html: "Fourth Item index value is 3"
                     }
                  ]
               });
               panel.setActiveItem(1); 
               Ext.Viewport.add(panel);
            }
         });
      </script>
   </head>
   <body>
   </body>
</html>

This will produce following result −

sencha_touch_layout.htm
Advertisements