Extjs学习

来源:互联网 发布:矩阵的伴随矩阵怎么求 编辑:程序博客网 时间:2024/06/08 17:54

1extjs的items属性什么意思?

items为控件的元素,即这些元素放在所属控件中,

ExtJS的控件组织结果是一个树结构,items可以理解成子节点集合,每一个item就是一个子节点
如:

  1.  /* 
  2.     使用items配置在面板中添加组件 
  3.     */ 
  4.       
  5.     /*使用items配置添加单一组件实例*/ 
  6.     Ext.onReady(function(){ 
  7.         var config = { 
  8.             headler:true, //面板头部 
  9.             title:'日历', //面板标题 
  10.             frame:true, //渲染 
  11.             collapsible:true, //允许伸展收缩 
  12.             autoHeight:true, //允许自动高度 
  13.             width:189, //面板固宽度 
  14.             renderTo:'panel', //面板定位 
  15.             items:new Ext.DatePicker() //向面板中添加一日期组件 
  16.         } 
  17.           
  18.         var panel = new Ext.Panel(config); 
  19.     }); 
  20.       
  21.     /*使用items配置添加多个组件实例*/ 
  22.     Ext.onReady(function(){ 
  23.         var config = { 
  24.             headler:true, 
  25.             title:'使用items配置添加多个组件', 
  26.             frame:true, 
  27.             height:200, 
  28.             width:250, 
  29.             renderTo:'panel', 
  30.             //设置所有面板的默认属性 
  31.             defaults:{ 
  32.                 bodyStyle:'background-color:#ffffff', //背景色 
  33.                 height:80, //面板固定高度 
  34.                 collapsible:true, //允许伸展收缩 
  35.                 autoScroll:true //自动显示滚动条 
  36.             }, 
  37.             //面板元素数组 
  38.             items:[ 
  39.                 //嵌套面板一 
  40.                 new Ext.Panel({ 
  41.                     title:'嵌套面板一', 
  42.                     contentEl:'localElement' //加载本地数据 
  43.                 }), 
  44.                 new Ext.Panel({ 
  45.                     title:'嵌套面板而', 
  46.                     autoLoad:'page1.html' //加载远程页面(失败) 
  47.                 }) 
  48.             ] 
  49.         } 
  50.           
  51.         var panel = new Ext.Panel(config); 
  52.     }); 


0 0
原创粉丝点击