zoukankan      html  css  js  c++  java
  • extjs中默认加载RadioGroup(单选框)的初始化值 子曰

    根据取出的数据来加载Radio的初始值,选用Ext.form.RadioGroup

    定义控件:
       {
             xtype:"panel",
             layout:"column",
             fieldLabel:'客户性别',
    xtype:'radiogroup',fieldLabel : "性别", anchor:'95%',columns: 2 ,items: 
    [{boxLabel: "先生", name: 'cst_sex',inputValue: '先生'},
    {boxLabel: "女士", name: 'cst_sex',inputValue: '女士'}
    ]
                 


     

     

    //radiogroup、checkboxgroup赋值,把下面一段加到代码的最上边
    Ext.override(Ext.form.BasicForm, {
        findField: function (id) {
            var field = this.items.get(id);
            if (!field) {
                this.items.each(function (f) {
                    if (f.isXType('radiogroup') || f.isXType('checkboxgroup')) {
                        f.items.each(function (c) {
                            if (c.isFormField && (c.dataIndex == id || c.id == id || c.getName() == id)) {
                                field = c;
                                return false;
                            }
                        });
                    }
    
                    if (f.isFormField && (f.dataIndex == id || f.id == id || f.getName() == id)) {
                        field = f;
                        return false;
                    }
                });
            }
            return field || null;
        }
    });

    效果:

     

  • 相关阅读:
    dede首页调用分类信息
    install sphinx
    rails新环境
    互联网创业三件事:钱、人和项目
    Remove Duplicate Elements from an Array using jQuery
    rails新环境
    rails新环境
    牛人
    电动车电池
    rails新环境
  • 原文地址:https://www.cnblogs.com/suixufeng/p/3336149.html
Copyright © 2011-2022 走看看