ExtJs3控件常用属性总结

来源:互联网 发布:ecshop数据库表结构 编辑:程序博客网 时间:2024/06/11 06:19

1:按钮的禁用于否:

属性: disabled : true, 初始化时为禁用

Ext.getCmp('updateb').disable(); //禁用按钮
Ext.getCmp('deleteb').enable();    //恢复可用

2:面板

Ext.getCmp('rulepanel').setVisible(true); //使面板可见

Ext.getCmp('rulepanel').setVisible(false); //使面板不可见

Ext.getCmp('rulepanel').collapse(true); //使rulepanel收缩

Ext.getCmp('rulepanel').expand(true);   //使rulepanel展开


3:checkbox

属性:inputValue 类似其value

view plaincopy to clipboardprint?
var popSelect = Ext.getCmp('panel3').findByType('checkbox');     
for(var i=0,j=0;i<popSelect.length;i++){  
   if(popSelect[i].checked){  
    pop[j++] = popSelect[i].inputValue;  
    if(popSelect[i].inputValue=='103'){  
     selectorder = Ext.getCmp('ruleid').getValue();  
    }  
   }  
}
var popSelect = Ext.getCmp('panel3').findByType('checkbox');  
for(var i=0,j=0;i<popSelect.length;i++){
   if(popSelect[i].checked){
    pop[j++] = popSelect[i].inputValue;
    if(popSelect[i].inputValue=='103'){
     selectorder = Ext.getCmp('ruleid').getValue();
    }
   }
}


body : Ext.Element
它是指向panel的body的Element引用。它被用于包含html内容。可以通过html config,或者是autoLoad config,又或者是通过panel的Updater来设置内容。此属性只读。
如果此属性被任何方法加载了html内容,那么这个panel就不能通过布局类来控制布局了。
如果这个panel已被布局类所管理,那么就不能对body进行任何改动,或加载什么内容。因为它正处于panel的布局管理类的控制之下。

buttons : Array
panel的button数组,它通过buttons config创建,只读。

dd : Ext.dd.DragSource.
如果此panel配置了draggable属性,这个属性将包含一个Ext.dd.DragSource的实例。开发人员通过必须提供对Ext.dd.DragSource的抽象方法的实现来达到支持drag/drop动作的目的。详情可见draggable。

disabled : Boolean
如果组件是disabled,那么它为true。只读。


footer : Ext.Element
指向panel footer的Element的引用。只读。它用于存放panel的buttons所定义的按钮。一般不要用它来放按钮。


header : Ext.Element
指向panel header的Element的引用。只读。这个元素用于存放title和tools。

hidden : Boolean
如果组件是隐藏的,那么它为true,只读。


initialConfig : Object
组件的config。只读。

items : MixedCollection
panel中的子组件的集合。

ownerCt : Ext.Container
组件的父组件,默认值为undefined,并且在加入到一个容器中时会被自动设置。只读。


rendered : Boolean
组件是否已经被呈现。。

公共方法:
Panel( Object config )

addButton( String/Object config, Function handler, Object scope ) : Ext.Button
config:如果是个字符串就被当作是按钮的text,如果是个object,那么它被当作config了。
handler:被按钮的Ext.Button.click调用。
scope:范围。
返回:被加入的按钮的实例。


collapse( Boolean animate ) : Ext.Panel
收缩面板


destroy() : void
看一下源码就知道,把组件挂接的事件、子元素什么的全部移除、delete。在什么Ext.ComponentMgr里面注册的东西也注销掉。


disable() : Ext.Component
没悬念。。使组件不可用。相当于大伙在dotnet中用得很爽的enabled。


doLayout( [Boolean shallow] ) : void
强制容器重新计算布局,就是刷新布局啦。它的作用就是当在render之后加入了一个组件时,这时就需要调用它来刷新一下了。又或者是改变了子组件的大小、位置,这时也要刷新一下。


expand( Boolean animate ) : Ext.Panel
伸展panel。


getBottomToolbar() : Ext.Toolbar
获得panel的bbar。

getFrameHeight() : Number
它的高度包括:header,tbar,bbar,footer,但是不包括body。单位是像素(px)。如果要获得body的高度,请使用getInnerHeight。


getFrameWidth() : Number
获得panel的边框宽度。当然是不包括body的宽度的,要获得body的宽度用getInnerWidth。

getId() : String
获得组件的id。


getInnerHeight() : Number
仅仅返回panel.body的高度。不包括其余四个部分。


getInnerWidth() : Number
仅仅返回panel.body的宽度。

getTopToolbar() : Ext.Toolbar
取得tbar的引用。

getUpdater() : Ext.Updater
通过Ext.Updater获得此panel的updater,有了它就能通过ajax更新panel.body了。

load( Object/String/Function config ) : Ext.Panel
通过一个XHR(XmlHttpRequest)调用马上加载内容。
示例代码如下:
panel.load({
    url: "your-url.php",
    params: {param1: "foo", param2: "bar"}, //或者是url编码的字符串
    callback: yourFunction,
    scope: yourObject,
    discardUrl: false,
    nocache: false,
    text: "Loading...",
    timeout: 30,
    scripts: false
});

这里面,唯一一个必须的属性就是url。


setIconClass( String cls ) : void
用于设置panel上的所有的icon的样式,如果哪个图标设置了样式,都会被它所替代。


toggleCollapse( Boolean animate ) : Ext.Panel
如果处理收缩状态就伸展,如果是伸展就收缩。总之与当前状态相反