ExtJs 备忘录(2)—— Form表单(二) [ 控件封装 ]

简介:
一、使用封装后Ext表单控件
    esayadd.aspx
<% @ Page Language = " C# "  AutoEventWireup = " true "  CodeFile = " esayadd.aspx.cs "  Inherits = " esayadd "   %>

<! 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 > 表单控件 </ title >
</ head >
< body >
    
< form  id ="form1"  runat ="server" >
< script  type ="text/javascript" >
    Ext.onReady(
function () {
    
        Ext.QuickTips.init();
        Ext.form.Field.prototype.msgTarget 
=   ' side ' ;

        
var  form1  =   new  Ext.FormPanel({
            layout: 
' form ' ,
            collapsible: 
true ,
            autoHeight: 
true ,
            frame: 
true ,
            renderTo: Ext.getBody(),
            title: 
' <center style="curor:hand" onclick="window.location.reload();">表单控件</center> ' ,
            style: 
' margin-left:auto;margin-right:auto;width:500px;margin-top:8px; ' ,
            
// 设置标签对齐方式
            labelAlign:  ' right ' ,
            
// 设置标签宽
            labelWidth:  170 ,
            
// 设置按钮的对齐方式
            buttonAlign: ' center ' ,
            
// 默认元素属性设置
            defaults:{
                    width:
180
                },
            items: [
                
new  TextField( ' TextBox ' , ' 文本框控件 ' ),
                
new  NumberField( ' TextBoxNumber ' , ' 只允许输入数字 ' ),
                
new  ComboBox( ' DropDownList ' , ' 下拉框控件 ' ,[[ 1 , ' ' ],[ 0 , ' ' ]]),
                
new  DateField( ' DateControl ' , ' 日历控件 ' ),
                
new  RadioGroup( ' RadioItems ' , ' 单选控件 ' ,[[ ' 选我 ' , ' A ' , true ],[ ' 选我吧 ' , ' B ' ]]),
                
new  CheckboxGroup( ' CheckboxItems ' , ' 复选控件 ' ,[[ ' 香蕉 ' , ' A ' ],[ ' 苹果 ' , ' B ' ],[ ' 橘子 ' , ' C ' ],[ ' 桃子 ' , ' D ' ]], 3 ),
                
new  TextArea( ' textarea ' , ' 文本域控件 ' , null , 50 , ' 可以输好多字! ' ),
                
new  TimeField( null , ' 时间控件 ' , 60 , ' H:i ' ),
                
new  FieldSet( ' 标签页 ' , ' 标签页 ' ,[ new  Panel( ' 标签页中的面板 ' , null , 50 , true )]),
                
new  HtmlEditor( ' htmleditor ' , ' 在线编辑器 ' , 260 , 100 )
            ],
            buttons: [{
                text: 
" 保 存 "
                ,handler:
function (){
                    MsgError(
' 错误 ' );
                    MsgWarning(
' 警告 ' );
                    MsgInfo(
' 提示 ' );
                    MsgConfirm(
' 确认 ' );
                }
            }, {
                text: 
" 取 消 "
                ,handler:
function (){
                    form1.form.reset();
                }
            }]
        });
    });
    
</ script >
    
</ form >
</ body >
</ html >
    代码说明:
      请大家比较 ExtJs 备忘录(1)—— Form表单(上) [ 控件使用 ] 中的add.aspx与本文esayadd.aspx,封装带来的简洁、易用和减少使用控件出错几率是显而易见的。 需要注意的是 ,这里只是做了简单的封装,因为Ext表单控件属性太多,起码也有10个以上,这里不可能把所有的属性都列为函数参数,所以根据实际项目情况进行调整,可以在这个现有函数基础上补上常用的参数设置,只要能满足80%-90%的情况价值就体现了 : )
二、Ext表单控件封装
    easy-ext.js    
// / <reference path="../adapter/ext/ext-base.js" />
//
/ <reference path="../ext-all.js" />

// <><><><><><><><><><><><><><><><><><><><>
//
 作 者:农民伯伯
//
 邮 箱:over140@gmail.com
//
 博 客:http://over140.cnblogs.com/
//
 时 间:2009-9-16
//
<><><><><><><><><><><><><><><><><><><><>

// #region Ext.form.TextField
function  TextField(fName,fLabel,defaultValue)
{
    
// / <summary>
     // / Ext.form.TextField封装
     // / </summary>
     // / <param name="fName">name</param>
     // / <param name="fLabel">fieldLabel</param>
     // / <param name="defaultValue">默认值</param>
     // / <returns>Ext.form.TextField</returns>
     var  text  =   new  Ext.form.TextField();
    
    
if (fName != null )
        text.name 
=  fName;
    
    
if (fLabel != null )
        text.fieldLabel 
=  fLabel;
    
    
// 设置默认值
     if (defaultValue  !=   null )
        text.setValue(defaultValue);
    
    
return  text;
}
// #endregion

// #region Ext.form.TextField
function  NumberField(fName,fLabel,defaultValue,allowDecimals,allowNegative,maxValue,minValue)
{
    
// / <summary>
     // / Ext.form.NumberField封装
     // / </summary>
     // / <param name="fName">name</param>
     // / <param name="fLabel">fieldLabel</param>
     // / <param name="defaultValue">默认值</param>
     // / <param name="allowDecimals">是否允许小数点</param>
     // / <param name="allowNegative">是否允许负数</param>
     // / <param name="maxValue">最大值</param>
     // / <param name="minValue">最小值</param>
     // / <returns>Ext.form.NumberField</returns>
     var  number  =   new  Ext.form.NumberField();
    
    
if (fName != null )
        number.name 
=  fName;
    
    
if (fLabel != null )
        number.fieldLabel 
=  fLabel;
    
    
// 设置默认值
     if (defaultValue  !=   null   &&   typeof (defaultValue)  ==   " number " )
        number.setValue(defaultValue);
    
    
// 设置是否允许小数点,默认(不设置)为不允许
     if (allowDecimals  !=   null   &&   typeof (allowDecimals)  ==   " boolean " )
        number.allowDecimals 
=  Boolean(allowDecimals);
        
    
// 设置是否允许负数,默认(不设置)为不允许
     if (allowNegative  !=   null   &&   typeof (allowNegative)  ==   " boolean " )
        number.allowNegative 
=  Boolean(allowNegative);     
    
    
// 设置最大值
     if (maxValue  !=   null   &&   typeof (maxValue)  ==   " number " )
        number.maxValue 
=  Number(maxValue);     
        
    
// 设置最小值
     if (minValue  !=   null   &&   typeof (minValue)  ==   " number " )
        number.minValue 
=  Number(minValue);
    
    
return  number;
}
// #endregion

// #region Ext.form.DateField
function  DateField(fName,fLabel,defaultValue,format,editable)
{
    
// / <summary>
     // / Ext.form.DateField封装
     // / </summary>
     // / <param name="fName">name</param>
     // / <param name="fLabel">fieldLabel</param>
     // / <param name="defaultValue">Boolean:true为当前日期/String: 按'Y-m-d'格式,如2009-1-1</param>
     // / <param name="format">设置日期格式化字符串</param>
     // / <param name="editable">是否允许输入,还是只能选择日期</param>
     // / <returns>Ext.form.DateField</returns>
     var  date  =   new  Ext.form.DateField();
    
    
if (fName != null )
        date.name 
=  fName;
    
    
if (fLabel != null )
        date.fieldLabel 
=  fLabel;
    
    
// 设置日期格式化字符串
     if (format  ==   null )
        format 
=   ' Y-m-d ' ;
    date.format 
=  format;
    
    
// 设置默认日期
     if (defaultValue  !=   null )
    {
        
if ( typeof (defaultValue)  ==   " boolean "   &&  Boolean(defaultValue)  ==   true )
        {
            date.setValue(
new  Date().dateFormat(format));
        }
        
else   if ( typeof (defaultValue)  ==   " string " )
        {
            
var  strDate  = String(defaultValue).split( " - " );
            
if (strDate.length == 3 )
                date.setValue(
new  Date(strDate[ 0 ],parseInt(strDate[ 1 ]) - 1 ,strDate[ 2 ]).dateFormat(format));
        }
    }
    
    
// 是否允许编辑
     if (editable == null )
        editable 
=   false ;
    
else   if ( typeof (editable)  ==   " boolean " )
        editable 
=  Boolean(editable);
    
    date.editable 
=  editable;
    
    
return  date;
}
// #endregion

// #region Ext.form.TimeField

function  TimeField(fName,fLabel,increment,format)
{
    
// / <summary>
     // / Ext.form.TimeField封装
     // / </summary>
     // / <param name="fName">name</param>
     // / <param name="fLabel">fieldLabel</param>
     // / <param name="increment">设置时间间隔,单位为分钟</param>
     // / <param name="format">格式化输出,支持格式如下:"g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H"</param>
     // / <returns>Ext.form.TimeField</returns>
     var  time  =   new  Ext.form.TimeField();
    
    
if (fName != null )
        time.name 
=  fName;
    
    
if (fLabel != null )
        time.fieldLabel 
=  fLabel;
        
    
// 设置时间间隔 默认为15分钟
     if (increment != null   &&   typeof (increment)  ==   " number " )
        time.increment 
=  Number(increment);
        
    
// 设置格式化输出 默认为 "g:i A"
     if (format  !=   null   &&   typeof (format)  ==   " string " )
        time.format 
=  String(format);
    
    
return  time;
}

// #endregion

// #region Ext.form.ComboBox
function  ComboBox(fName,fLabel,dataStore,defaultValue,displayField,valueField,editable)
{
    
// / <summary>
     // / Ext.form.ComboBox封装
     // / </summary>
     // / <param name="fName">name</param>
     // / <param name="fLabel">fieldLabel</param>
     // / <param name="dataStore">数据源。本地模式,如[[1,'男'],[0,'女']];远程模式,传入Ext.data.Store</param>
     // / <param name="defaultValue">默认值</param>
     // / <param name="displayField">选项的文本对应的字段</param>
     // / <param name="valueField">选项的值对应的字段</param>
     // / <param name="editable">是否可以输入,还是只能选择下拉框中的选项</param>
     // / <returns>Ext.form.ComboBox</returns>
     var  combo  =   new  Ext.form.ComboBox({
        mode: 
' local ' ,
        editable : 
false ,
        typeAhead: 
true ,
        triggerAction: 
' all ' ,
        selectOnFocus:
true
    });
    
    
if (fName != null )
        combo.name 
=  fName;
    
    
if (fLabel != null )
        combo.fieldLabel 
=  fLabel;
        
    
if (displayField == null   ||   typeof (displayField)  !=   " string " )
        displayField 
=   " Name " ;
    combo.displayField 
=  String(displayField);
        
    
if (valueField == null   ||   typeof (valueField)  !=   " string " )
        valueField 
=   " Id " ;
    combo.valueField 
=  String(valueField);    
    
    
// 设置数据源
     if (Ext.isArray(dataStore))
    {
        combo.store 
=   new  Ext.data.SimpleStore({
            fields: [valueField, displayField],
            data:dataStore
        });
    }
    
else
    {
        combo.store 
=  dataStore;
        combo.mode 
=   ' remote ' ;
    }
    
    
// 设置默认值
     if (defaultValue != null )
        combo.setValue(defaultValue);
    
    
// 是否允许编辑
     if (editable != null   &&   typeof (editable)  ==   " boolean " )
        combo.editable 
=  Boolean(editable);  
    
    
return  combo;
}
// #endregion

// #region Ext.form.TextArea

function  TextArea(fName,fLabel,width,height,value)
{
    
// / <summary>
     // / Ext.form.TextArea封装
     // / </summary>
     // / <param name="fName">name</param>
     // / <param name="fLabel">fieldLabel</param>
     // / <param name="width">width</param>
     // / <param name="height">height</param>
     // / <param name="value">value</param>
     // / <returns>Ext.form.TextArea</returns>
     var  area  =   new  Ext.form.TextArea();

    
if (fName != null )
        area.name 
=  fName;
    
    
if (fLabel != null )
        area.fieldLabel 
=  fLabel;
        
    
if (width != null   &&   typeof (width)  ==   " number " )
        area.width 
=  Number(width);
        
    
if (height != null   &&   typeof (height)  ==   " number " )
        area.height 
=  Number(height);
        
    
if (value != null )
        area.value 
=  value;
        
    
return  area;
}

// #endregion

// #region Ext.form.RadioGroup

function  RadioGroup(fName,fLabel,items,columns)
{
    
// / <summary>
     // / Ext.form.RadioGroup封装
     // /     例子:new RadioGroup('Gender','性别',[['男','男',true],['女','女']])
     // / <param name="fName">name</param>
     // / <param name="fLabel">fieldLabel</param>
     // / <param name="items">数据,格式如下:[['男','男',true],['女','女']]</param>
     // / <param name="columns">设置几列自动排列,如果是1的话会按一行来显示</param>
     // / </summary>
     // / <returns>Ext.form.RadioGroup</returns>
     var  rg  =   new  Ext.form.RadioGroup();
    
    
if (fName != null )
        rg.name 
=  fName;
    
    
if (fLabel != null )
        rg.fieldLabel 
=  fLabel;
    
    
if (columns != null   &&   typeof (columns)  ==   " number " )
        rg.columns 
=  Number(columns);
        
    
var  rebuildiItems  =   new  Array();
        
    
if (items  != null ){
        
for ( var  i  =   0  ;i < items.length; i ++ )
        {
            rebuildiItems[i] 
=  {};
            rebuildiItems[i].name 
=  fName;
            rebuildiItems[i].boxLabel 
=  items[i][ 0 ];
            rebuildiItems[i].inputValue 
=  items[i][ 1 ];
            
if (items[i].length  >   2   &&   typeof (items[i][ 2 ])  ==   " boolean " )
                rebuildiItems[i].checked 
=  Boolean(items[i][ 2 ]);
        }
        
        
// Ext.form.RadioGroup扩展
        Ext.override(Ext.form.CheckboxGroup, {
            setItems:
function (data){
                
this .items  =  data;
            }
        });

        
if (rg.setItems){
            rg.setItems(rebuildiItems);
        }        
    }
    
    
return  rg;
}

// #endregion

// #region Ext.form.CheckboxGroup

function  CheckboxGroup(fName,fLabel,items,columns)
{
    
// / <summary>
     // / Ext.form.CheckboxGroup封装
     // /     例子:new CheckboxGroup('Gender','性别',[['男','男',true],['女','女']])
     // / <param name="fName">name</param>
     // / <param name="fLabel">fieldLabel</param>
     // / <param name="items">数据,格式如下:[['男','男',true],['女','女']]</param>
     // / <param name="columns">设置几列自动排列,如果是1的话会按一行来显示</param>
     // / </summary>
     // / <returns>Ext.form.CheckboxGroup</returns>
     var  cg  =   new  Ext.form.CheckboxGroup();
    
    
if (fName != null )
        cg.name 
=  fName;
    
    
if (fLabel != null )
        cg.fieldLabel 
=  fLabel;
    
    
if (columns != null   &&   typeof (columns)  ==   " number " )
        cg.columns 
=  Number(columns);
        
    
var  rebuildiItems  =   new  Array();
        
    
if (items  != null ){
        
for ( var  i  =   0  ;i < items.length; i ++ )
        {
            rebuildiItems[i] 
=  {};
            rebuildiItems[i].name 
=  fName;
            rebuildiItems[i].boxLabel 
=  items[i][ 0 ];
            rebuildiItems[i].inputValue 
=  items[i][ 1 ];
            
if (items[i].length  >   2   &&   typeof (items[i][ 2 ])  ==   " boolean " )
                rebuildiItems[i].checked 
=  Boolean(items[i][ 2 ]);
        }
        
        
// Ext.form.RadioGroup扩展
        Ext.override(Ext.form.CheckboxGroup, {
            setItems:
function (data){
                
this .items  =  data;
            }
        });

        
if (cg.setItems){
            cg.setItems(rebuildiItems);
        }        
    }
    
    
return  cg;
}

// #endregion

// #region Ext.form.HtmlEditor

function  HtmlEditor(fName,fLabel,width,height,value)
{
    
// / <summary>
     // / Ext.form.HtmlEditor封装
     // / </summary>
     // / <param name="fName">name</param>
     // / <param name="fLabel">fieldLabel</param>
     // / <param name="width">width</param>
     // / <param name="height">height</param>
     // / <param name="value">value</param>
     // / <returns>Ext.form.HtmlEditor</returns>
     var  editor  =   new  Ext.form.HtmlEditor();

    
if (fName != null )
        editor.name 
=  fName;
    
    
if (fLabel != null )
        editor.fieldLabel 
=  fLabel;
        
    
if (width != null   &&   typeof (width)  ==   " number " )
        editor.width 
=  Number(width);
        
    
if (height != null   &&   typeof (height)  ==   " number " )
        editor.height 
=  Number(height);
        
    
if (value != null )
        editor.value 
=  value;
        
    
return  editor;
}

// #endregion

// #region Ext.form.Hidden

function  Hidden(fName,value)
{
    
// / <summary>
     // / Ext.form.Hidden封装
     // / </summary>
     // / <param name="fName">name</param>
     // / <param name="value">value</param>
     // / <returns>Ext.form.Hidden</returns>
     var  hidden  =   new  Ext.form.Hidden();

    
if (fName != null )
        hidden.name 
=  fName;
        
    
if (value != null )
        hidden.value 
=  value;
        
    
return  hidden;
}

// #endregion

// #region Ext.form.Checkbox

function  Checkbox(fName,fLabel,value,boxLabel,inputValue,checked)
{
    
// / <summary>
     // / Ext.form.Checkbox封装
     // / </summary>
     // / <param name="fName">name</param>
     // / <param name="fLabel">fieldLabel</param>
     // / <param name="value">value</param>
     // / <param name="boxLabel"></param>
     // / <param name="inputValue"></param>
     // / <param name="checked"></param>
     // / <returns>Ext.form.Checkbox</returns>
     var  checkbox  =   new  Ext.form.Checkbox();

    
if (fName != null )
        checkbox.name 
=  fName;
        
    
if (fLabel != null )
        checkbox.fieldLabel 
=  fLabel;
        
    
if (value != null )
        checkbox.value 
=  value;
        
    
if (boxLabel != null   &&   typeof (boxLabel)  ==   " string " )
        checkbox.boxLabel 
=  String(boxLabel);
    
    
if (inputValue != null )
        checkbox.inputValue 
=  inputValue;
        
    
if (checked != null   &&   typeof (checked)  ==   " boolean " )
        checkbox.checked 
=  Boolean(checked);
        
    
return  checkbox;
}

// #endregion

// #region Ext.form.FieldSet

function  FieldSet(fName,title,items)
{
    
// / <summary>
     // / Ext.form.FieldSet封装
     // / </summary>
     // / <param name="fName">fieldLabel</param>
     // / <param name="title">title</param>
     // / <param name="items">数据源</param>
     // / <returns>Ext.form.FieldSet</returns>
     var  fieldset  =   new  Ext.form.FieldSet();
    
    
if (fName != null )
        fieldset.fieldLabel 
=  fName;
        
    
if (title != null    &&   typeof (title)  ==   " string " )
        fieldset.title 
=  String(title);
        
    
if (items != null )
        fieldset.add(items);
    
    
return  fieldset;
}

// #endregion

// #region Ext.Panel

function  Panel(title,width,height,frame)
{
    
// / <summary>
     // / Ext.Panel封装
     // / </summary>
     // / <param name="title">name</param>
     // / <param name="width">value</param>
     // / <param name="height">height</param>
     // / <param name="frame">frame</param>
     // / <returns>Ext.Panel</returns>
     if (title  == null )
        title 
=   '' ;   // 默认值 如果为此值则不显示标题栏
        
    
var  panel  =   new  Ext.Panel({
        title:title
    });
        
    
if (width != null   &&   typeof (width)  ==   " number " )
        panel.width 
=  Number(width);
        
    
if (height != null   &&   typeof (height)  ==   " number " )
        panel.height 
=  Number(height);
        
    
if (frame != null   &&   typeof (frame)  ==   " boolean " )
        panel.frame 
=  Boolean(frame);
    
    
return  panel;
}

// #endregion

// #region MessageBox

function  MsgConfirm(msg,title,fn,width)
{
    
// / <summary>
     // / Ext.Msg.show 问题确认框
     // / </summary>
     // / <param name="msg">设置要输出的信息</param>
     // / <param name="title">设置确认框标题</param>
     // / <param name="fn">设置回调fn函数</param>
     // / <param name="width">设置确认框宽</param>
     // / <returns>Ext.Msg.show</returns>
     if (msg  == null )
        msg 
=   "" ;
    
    
if (title  ==   null   ||   typeof (title)  !=   " string " )
        title 
=   " 问题 " ;
        
    
if (width  ==   null   ||   typeof (width)  !=   " number " )
        width 
=   400 ;
        
    
if (fn  ==   null   ||   typeof (fn)  !=   " function " )
        fn 
=   new   function (){};
    
    
return  Ext.Msg.show({
        title: title,
        msg: msg,
        width: width,
        icon:Ext.MessageBox.QUESTION,
        buttons: Ext.MessageBox.YESNO,
        fn:fn
    });
}

function  MsgInfo(msg,title,width)
{
    
// / <summary>
     // / Ext.Msg.show 信息提示框
     // / </summary>
     // / <param name="msg">设置要输出的信息</param>
     // / <param name="title">设置标题</param>
     // / <param name="width">设置提示框宽</param>
     // / <returns>Ext.Msg.show</returns>
     if (msg  == null )
        msg 
=   "" ;
    
    
if (title  ==   null   ||   typeof (title)  !=   " string " )
        title 
=   " 提示 " ;
        
    
if (width  ==   null   ||   typeof (width)  !=   " number " )
        width 
=   400 ;
        
    
return  Ext.MessageBox.show({
        title: title,
        msg: msg,
        width: width,
        icon:Ext.MessageBox.INFO,
        buttons: Ext.MessageBox.OK
    });
}

function  MsgError(msg,title,width)
{
    
// / <summary>
     // / Ext.Msg.show 错误提示框
     // / </summary>
     // / <param name="msg">设置要输出的信息</param>
     // / <param name="title">设置标题</param>
     // / <param name="width">设置提示框宽</param>
     // / <returns>Ext.Msg.show</returns>
     if (msg  == null )
        msg 
=   "" ;
    
    
if (title  ==   null   ||   typeof (title)  !=   " string " )
        title 
=   " 错误 " ;
        
    
if (width  ==   null   ||   typeof (width)  !=   " number " )
        width 
=   400 ;

    
return  Ext.MessageBox.show({
        title: title,
        msg: msg,
        width: width,
        icon:Ext.MessageBox.ERROR,
        buttons: Ext.MessageBox.OK
    });
}

function  MsgWarning(msg,title,width)
{
    
// / <summary>
     // / Ext.Msg.show 警告提示框
     // / </summary>
     // / <param name="msg">设置要输出的信息</param>
     // / <param name="title">设置标题</param>
     // / <param name="width">设置提示框宽</param>
     // / <returns>Ext.Msg.show</returns>
     if (msg  == null )
        msg 
=   "" ;
    
    
if (title  ==   null   ||   typeof (title)  !=   " string " )
        title 
=   " 警告 " ;
        
    
if (width  ==   null   ||   typeof (width)  !=   " number " )
        width 
=   400 ;

    
return  Ext.MessageBox.show({
        title: title,
        msg: msg,
        width: width,
        icon:Ext.MessageBox.WARNING,
        buttons: Ext.MessageBox.OK
    });
}

// #endregion
    代码说明:
      这里封装了常用的Form表单控件、Panel控件、以及弹出消息提示的封装。这里为什么要封装MSG框呢,根据我使用ext3.0rc2的经验,如果不指定MSG宽且MSG字符串过少的话可能出现对话框残缺的情况,不知道是不是它的BUG,3.0正式版好像没有这情况,但还是封装了,这样能兼容前面的版本。
三、说明
    1.  写好封装js后,还需要把它加入到head里面,以便其他地方也能方便使用,注意上篇文章ExtHelper.cs我注释的部分,解除注释即可。注意这里文件名称可能有变化,对应修改即可。
    2.  封装的好处在贴esayadd.aspx代码后面的说明里面有说,对于动辄几百行的JS代码,这样还是能有效的减少代码量,也不容易出错。一旦封装好后就不要轻易修改了,如果要修改也必须保证只能增加参数,这样才能保证你前面写的代码调用没有问题,对于特殊的复杂的设置可以在封装的基础上继续设置(你可以看到return 都是Ext的对象)或者重新写一个可能比较好!
四、下载

    1.  ExtJS2009-9-20.rar

本文转自博客园农民伯伯的博客,原文链接:ExtJs 备忘录(2)—— Form表单(二) [ 控件封装 ],如需转载请自行联系原博主。

目录
相关文章
|
前端开发 JavaScript 程序员
【前端】使用jQuery封装一套UI组件 - 单选框
目前前端技术发展非常快,各大厂都开源和分享了自家的前端框架,非常多成熟的UI组件供大家选择,很实用也很方便,给开发上节省了不少时间成本,当然少不了学习成本,不过也不会占用太多时间,只要有前端基础的话,原理基本都是通用的,只是写法不一样。 因此,除了学习现有的优秀前端之外,最好能自己根据原理封装一套自己的UI组件,目的是为了更好的理解前端知识点以及锻炼编程逻辑
131 0
|
JavaScript 前端开发 程序员
【前端】使用jQuery封装一套UI组件 - 可编辑下拉框组件
下拉框也是比较常用的组件,对应原生的下拉标签就是select 本篇文章就来讲讲可编辑下拉框组件的封装过程
330 0
|
存储 前端开发 JavaScript
【JavaScript框架封装】实现一个类似于JQuery的选择框架的封装
版权声明:本文为博主原创文章,未经博主允许不得转载。更多学习资料请访问我爱科技论坛:www.52tech.tech https://blog.csdn.net/m0_37981569/article/details/81123799 ...
1046 0
|
存储 缓存
|
Android开发 容器
用安卓原生控件封装一个简易的富文本编辑器
最近接到项目需求:移动端原生写一个富文本编辑器。        ( ⊙ o ⊙ )从没遇到过富文本要用原生写的,然后就查阅各种资料。然后结合自己的思路:其实安卓的富文本编辑器就是一个 “容器”。
1400 0
|
JavaScript 前端开发 索引
前端备忘录--JQuery选择器
基本选择器   基本选择器是最常用的选择器,也是最简单的选择器. $("#test") //选取id为test的元素 $(".test") //选取class为test的元素 $("div.
1096 0