Ext.js Ext.form.Panel容器

2022-05-19 11:49 更新

描述

Ext.form.Panel:Form面板為表單提供了一個標準容器,它本質(zhì)上是一個標準的Ext.panel.Panel,它自動創(chuàng)建一個用于管理任何Ext.form.field.Field對象的BasicForm。

語法

這里是創(chuàng)建Ext.form.Panel容器的簡單語法。

Ext.create('Ext.form.Panel', {
   items: [child1, child2] // 這樣我們可以將不同的子元素作為容器項添加到容器中。
});

例子

下面是一個簡單的例子顯示Ext.form.Panel容器。

<!DOCTYPE html>
<html>
<head>
    <link href="./ext-6.0.0/build/classic/theme-classic/resources/theme-classic-all.css" rel="stylesheet">
    <script src="./ext-6.0.0/build/ext-all.js"></script>
    <script type="text/javascript">
        Ext.onReady(function () {
            var child1 = Ext.create('Ext.Panel',{     
                html: 'Text field' 
            });
            var child2 = Ext.create('Ext.Panel',{
                html: 'Text field' 
            });
            Ext.create('Ext.form.Panel', {
                renderTo: Ext.getBody(),
                width: 100,
                height : 100,
                border : true,
                frame : true,
                layout: 'auto',// auto is one of the layout type.
                items: [child1, child2]
            });
        });
    </script>
</head>
<body>
</body>
</html>


運行結果截圖:


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號