ExtJS 常用组件属性 及使用方法

  1. /*
  2. Ext.Panel主要配置表:
  3. animCollapse Boolean  设置面板折叠展开是否显示动画,Ext.Fx可用默认true,否则false
  4. applyTo      Mixed    面板定位
  5. autoDestroy Boolean   是否自动销毁从容器中移除组件(默认true)
  6. autoHeight Boolean    是否自动高度(默认false)
  7. autoLoad Object/String/Function 设置面板自动加载的url
  8. autoScroll Boolean 设置是否自动加载滚动条(默认false自动加滚动条)
  9. autoShow Boolean 是否移除组件的隐藏样式(默认flase)
  10. autoWidth Boolean 是否自动宽度(默认false)
  11. baseCls String 面板的基本样式类(默认x-panel)
  12. bbar Object/Array 设置面板底端工具栏,可是Ext.Toolbar,工具栏配置对象,button的数组
  13. bodyBorder Boolean 是否显示面板体内部边框(默认true,在border=true生效)
  14. bodyStyle String/Object/Function 应用于面板体的自定义样式(默认null)
  15. border Boolean 是否显示面板体边框(默认true,2px)
  16. buttonAlign String 设置面板底部按钮对齐方式(默认right,可为left,center)
  17. buttons Arry 设置面板底部按钮配置数组
  18. collapseFirst Boolean 该项决定展开收缩按钮的位置(默认true)
  19. collapsed Boolean 设置面板在第一次渲染时是否处于收缩状态(默认true)
  20. collapsible Boolean 是否允许面板展开收缩(默认false)
  21. contentEI String 设置面板的内容元素,可为页面元素id,已存在的HTML节点
  22. defaultType String 面板中元素的默认类型(默认panel)
  23. defaults Object 应用到面板容器中所有元素配置对象,如:defaults:{bodyStyle:'padding:15px'}
  24. floating Boolean 设置面板是否可浮动(默认true,会导致面板显示负偏移,位置要明确设置!)
  25. footer Boolean 设置是否创建面板底部元素(默认true)
  26. frame Boolean 设置是否渲染面板
  27. header Boolean 设置是否创建头部(默认true)
  28. headerAsText Boolean 是否在面板header中显示title(默认true)
  29. height Number 面板高度(默认auto)
  30. hideBorders Boolean true隐藏面板中所有元素的边框,false据组件具体配置
  31. hideCollapseTool Boolean 设置当collapsible为true是,是否显示展开收缩按钮
  32. html String/Object 设置面板元素内容为HTML片段或DomHelper生成内容
  33. items Mixed 单独一个子组件或子组件数组
  34. layout String 面板布局类型(默认Ext.layout.ContainerLayout布局)
  35. layoutConfig Object 这个配置对象包含被选布局的配置项
  36. maskDisabled Boolean 设置当面板不可使用时是否遮罩面目(默认true)
  37. shadow Boolean/String 设置是否在面板后显示阴影(默认true)
  38. shadowOffset Number 设置面板阴影偏移量(默认4)
  39. tbar Object/Array 设置面板顶端工具栏,可是Ext.Toolbar,工具栏配置对象,button配置对象数组,面板
  40.                                                        渲染后只能通过getTopToolbar方法访问该工具栏
  41. title String 显示在面板的头部标题信息
  42. titleCollapse Boolean 设置是否允许单击面板头部进行展开收缩(默认false)
  43. tools Array 面板头部工具按钮配置对象数组
  44. width Number 面板宽度(默认auto)
  45.  
  46. tools配置表:
  47. id String 必选
  48. handler Function 单击按钮后出发的处理函数
  49. scope Object 处理函数执行范围
  50. qtip String/Object 为按钮指定提示信息
  51. hidden Boolean 设置初次渲染是否隐藏
  52. on Object 为按钮配置事件监听
  53.  
  54. tools配置项id对应不同按钮
  55. */

  1. <mce:script type="text/javascript"><!--
  2.     Ext.onReady(function(){
  3.         var config = {
  4.             title:'面板头部(hear)',
  5.             tbar:['顶端工具栏(top toolbars)'],
  6.             bbar:['底端工具栏(bottom toolbars)'],
  7.             height:200,
  8.             width:300,
  9.             frame:true,
  10.             renderTo:'panel',
  11.             bodyStyle:'background-color:#ffffff',
  12.             html:'
    面板体(body)
    ',
  13.             tools:[
  14.                 {id:'toggle'},
  15.                 {id:'close'},
  16.                 {id:'maximize'}
  17.             ],
  18.             buttons:[
  19.                 new Ext.Button({
  20.                     text:'面板底部(footer)'
  21.                 })
  22.             ]
  23.         }
  24.           
  25.         new Ext.Panel(config);
  26.     });
  27.    
通过面板加载内容的方式有:
1.通过autoLoad加载远程页面
  1. <mce:script type="text/javascript"><!--
  2.     /*
  3.     使用autoLoad加载远程页面
  4.     */
  5.       
  6.     Ext.onReady(function(){
  7.         var config = {
  8.             title:'面板加载远程页面',
  9.             height:150,
  10.             width:250,
  11.             frame:true,
  12.             autoScroll:true,
  13.             collapsible:true, //允许展开和收缩
  14.             applyTo:'panel',
  15.             autoLoad:{url:'page1.html'}, //自动加载面板体的链接
  16.             bodyStyle:'background-color:#ffffff'
  17.         }
  18.           
  19.         var panel = new Ext.Panel(config);
  20.     });
  21.    
2.通过contentEl加载本地资源
  1. <mce:script type="text/javascript"><!--
  2.     /*
  3.     contentEI加载本地资源
  4.     */
  5.       
  6.     Ext.onReady(function(){
  7.         var config = {
  8.             title:'面板加载本地数据',
  9.             height:150,
  10.             width:250,
  11.             frame:true,
  12.             collapsible:true,
  13.             autoScroll:true,
  14.             autoHeight:false,
  15.             //autoHeight:true,
  16.             renderTo:'panel',
  17.             contentEl:'localElement', //要加载的本地资源的id,contentEl中l为小写的L!
  18.             bodyStyle:'background-color:#ffffff'
  19.         }
  20.           
  21.         new Ext.Panel(config);
  22.     });
  23.    

  1. <table id='localElement'>
  2.         <tr>
  3.             <td colspan="2">远程页面</td>
  4.         </tr>
  5.         <tr>
  6.             <td width="60">编号</td>
  7.             <td width="80">姓名</td>
  8.         </tr>
  9.         <tr>
  10.             <td>编号</td>
  11.             <td>姓名</td>
  12.         </tr>
  13.         <tr>
  14.             <td>编号</td>
  15.             <td>姓名</td>
  16.         </tr>
  17.         <tr>
  18.             <td>编号</td>
  19.             <td>姓名</td>
  20.         </tr>
  21.         <tr>
  22.             <td>编号</td>
  23.             <td>姓名</td>
  24.         </tr>
  25.     </table>
3.通过html配置自定义面板内容
  1. <mce:script type="text/javascript"><!--
  2.     var htmlArray = [
  3.         '',
  4.         '',
  5.         '',
  6.         '',
  7.         '',
  8.         '',
  9.         '',
  10.         '',
  11.         '',
  12.         '',
  13.         '',
  14.         '
    html配置自定义面板内容
    编号姓名
    编号姓名
    编号姓名
    编号姓名
    编号姓名
    编号姓名
    编号姓名
    编号姓名
    编号姓名
    '
  15.     ];
  16.       
  17.     var config = {
  18.         title:'使用html配置自定义面板内容', //panel标题
  19.         height:150, //panel高
  20.         width:250, //panel宽
  21.         frame:true, //渲染
  22.         collapsible:true, //允许展开收缩
  23.         autoScroll:true, //允许显示滚动条
  24.         autoHeight:false, //使用固定高度
  25.         //autoHeight:true, //自适应高度
  26.         renderTo:'panel', //定位
  27.         html:htmlArray.join(''), //panel中显示的自定义html代码
  28.         bodyStyle:'background-color:#ffffff' //panel背景色
  29.     }
  30.       
  31.     var panel = new Ext.Panel(config);
  32.    
4.通过items配置在面板中添加组件
  1. <mce:script type="text/javascript"><!--
  2.     /*
  3.     使用items配置在面板中添加组件
  4.     */
  5.       
  6.     /*使用items配置添加单一组件实例*/
  7.     Ext.onReady(function(){
  8.         var config = {
  9.             headler:true, //面板头部
  10.             title:'日历', //面板标题
  11.             frame:true, //渲染
  12.             collapsible:true, //允许伸展收缩
  13.             autoHeight:true, //允许自动高度
  14.             width:189, //面板固宽度
  15.             renderTo:'panel', //面板定位
  16.             items:new Ext.DatePicker() //向面板中添加一日期组件
  17.         }
  18.           
  19.         var panel = new Ext.Panel(config);
  20.     });
  21.       
  22.     /*使用items配置添加多个组件实例*/
  23.     Ext.onReady(function(){
  24.         var config = {
  25.             headler:true,
  26.             title:'使用items配置添加多个组件',
  27.             frame:true,
  28.             height:200,
  29.             width:250,
  30.             renderTo:'panel',
  31.             //设置所有面板的默认属性
  32.             defaults:{
  33.                 bodyStyle:'background-color:#ffffff', //背景色
  34.                 height:80, //面板固定高度
  35.                 collapsible:true, //允许伸展收缩
  36.                 autoScroll:true //自动显示滚动条
  37.             },
  38.             //面板元素数组
  39.             items:[
  40.                 //嵌套面板一
  41.                 new Ext.Panel({
  42.                     title:'嵌套面板一',
  43.                     contentEl:'localElement' //加载本地数据
  44.                 }),
  45.                 new Ext.Panel({
  46.                     title:'嵌套面板而',
  47.                     autoLoad:'page1.html' //加载远程页面(失败)
  48.                 })
  49.             ]
  50.         }
  51.           
  52.         var panel = new Ext.Panel(config);
  53.     });
  54.    
摘自: http://blog.csdn.net/lulu_jiang/article/details/5474370
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值