Ext.form.field.CheckBox復選框和Ext.form.field.Radio單選框


1、Ext.form.field.CheckBox和Ext.form.field.Radio主要配置項目

配置項 類型 說明
boxLabel String 緊靠復選框的文字描述
boxLabelAlign String

設置復選框關聯標簽的位置,

有效值包括:“before”和“after”,默認為“after”

checked Boolean 設置復選框默認是否被選中,默認為false
handler Function

設置當選中狀態發生變化時的處理函數,

傳入參數為:

checkbox:Ext.form.Checkbox復選框組件

checked:Boolean新的選中狀態

inputValue String 提交值,默認為“on”
scope Object 設置handler處理函數的作用范圍
uncheckedValue String 設置當復選框未選中時向后台提交的值,默認為undefined

2、Ext.form.field.CheckBox和Ext.form.field.Radio示例

代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Ext.form.field.CheckBox和Ext.form.field.Radio示例</title>
    <link href="ext-4.0.7-gpl/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
    <script src="ext-4.0.7-gpl/bootstrap.js" type="text/javascript"></script>
    <script type="text/javascript">
        Ext.onReady(function () {
            new Ext.form.Panel({
                title: "Ext.form.field.CheckBox和Ext.form.field.Radio示例",
                bodyStyle: "padding:5",
                frame: true,
                height: 150,
                width: 300,
                renderTo: Ext.getBody(),
                defaults: {
                    labelSeparator: "",
                    labelWidth: 80,
                    width: 200,
                    labelAlign: "left"
                },
                items: [{
                    xtype:"radio",
                    name:"sex",
                    fieldLabel:"性別",
                    boxLabel:""
                }, {
                    xtype: "radio",
                    name: "sex",
                    fieldLabel: "性別",
                    boxLabel: ""
                }, {
                    xtype: "checkboxfield",
                    name: "swim",
                    fieldLabel: "愛好",
                    boxLabel: "游泳"
                }, {
                    xtype: "checkboxfield",
                    name: "walk",
                    fieldLabel: "愛好",
                    boxLabel: "散步"
                }]
            });
        });
    </script>
</head>
<body>
</body>
</html>

效果圖:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM