Sencha-touch-data-view

提供:Dev Guides
移動先:案内検索

Sencha Touch-データビュー

説明

これは、ストア値に基づいて複数のビューを動的に作成するためです。 基本的に同じコンポーネントを複数回表示する場合は、データビューを使用します。

構文

以下は、データビューを作成する簡単な構文です。

Ext.create('Ext.DataView', {})

以下は、使用法を示す簡単な例です。

<!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 touchTeam = Ext.create('Ext.DataView', {
                  fullscreen: true,

                  store: {
                     fields: ['name', 'age'],
                     data: [
                        {name: 'Greg',  age: 100},
                        {name: 'Brandon',   age: 21},
                        {name: 'Scott',   age: 21},
                        {name: 'Gary', age: 24},
                        {name: 'Fred', age: 24},
                        {name: 'Seth',   age: 26},
                        {name: 'Kevin',   age: 26},
                        {name: 'Israel',   age: 26},
                        {name: 'Mitch', age: 26}
                     ]
                  },

                  itemTpl: '{name} is {age} years old'
               });
            }
         });
      </script>
   </head>
   <body>
   </body>
</html>

これにより、次の結果が生成されます–