ext.button 常用 函數 屬性__函數

來源:互聯網
上載者:User

var buttonName = new Ext.Button({
               id:"buttonName",
               text:"Button組件基本用法",
               tooltip:"提示資訊:Button組件基本用法",
               //提示資訊,如果需要顯示提示資訊,需要使用Ext.QuickTips.init();        
               tooltipType:"title", //定義顯示提示資訊的類型,有qtip和title兩種方式,預設是qtip
             
               type:"button", //按鈕類型:可以是submit, reset or button  預設是 button
             
               autoShow:true, //預設false,自動顯示
            
               hidden:false, //預設false,是否隱藏
            
               hideMode:"offsets", //隱藏方式,預設display,可以取值:display,offsets,visibility           
               cls:"cssButton", //樣式定義,預設""
            
               disabled:false, //是否可用,預設false
            
               disabledClass:"", //預設x-item-disabled
            
               enableToggle:true, //預設false
            
               pressed:false, //設定按鈕是否已經被按下,預設是false
            
               html:"Ext",//預設""
            
               handleMouseEvents:true, //預設true,如果為false,那麼mouseout mouseover就不能被觸發
             
              //x:number,y:number,在容器中的x,y座標 
             
               handler:function(){Ext.Msg.alert('提示訊息框','測試Button組件:handler事件。');},//添加事件
            
               listeners:{//添加監聽事件 可以結合handler測試這兩個事件哪個最先執行
                  "click":function(){
                       Ext.Msg.alert('提示訊息框','測試Button組件:listeners事件。');
                       Ext. getCmp_r("buttonName").hide();//隱藏按鈕
                  }
              },
            
               cls:"x-btn-text-icon",//添加表徵圖前需要設定該屬性
             
               icon:"house.gif", //表徵圖的地址
            
               //plugins : Object/Array 擴充外掛程式時使用
            
               repeat:false, //預設false ,如果為true,需要設定mouseover事件
            
               renderTo:"Bind_Button" //將組件的顯示效果渲染到某個節點的ID
             
        });
配置:
1. id:"buttonName",
2. text:"Button組件基本用法",
3. tooltip:"提示資訊:Button組件基本用法", //提示資訊,如果需要顯示提示資訊,需要使用Ext.QuickTips.init();
4. ooltipType:"title", //定義顯示提示資訊的類型,有qtip和title兩種方式,預設是qtip
5. ype:"button", //按鈕類型:可以是submit, reset or button  預設是 button
6. autoShow:true, //預設false,自動顯示
7. hidden:false, //預設false,是否隱藏
8. hideMode:"offsets", //隱藏方式,預設display,可以取值:display,offsets,visibility
9. cls:"cssButton", //樣式定義,預設""
10. disabled:false, //是否可用,預設false
11. disabledClass:"", //預設x-item-disabled
12. enableToggle:true, //預設false
13. pressed:false, //設定按鈕是否已經被按下,預設是false
14. html:"Ext",//預設""
15. handleMouseEvents:true, //預設true,如果為false,那麼mouseout mouseover就不能被觸發
16. x:number,y:number,在容器中的x,y座標 
17. handler:function(){Ext.Msg.alert('提示訊息框','測試Button組件:handler事件。');},//添加事件
18. listeners:{//添加監聽事件 可以結合handler測試這兩個事件哪個最先執行
         "click":function(){
             Ext.Msg.alert('提示訊息框','測試Button組件:listeners事件。');
             Ext. getCmp_r("buttonName").hide();//隱藏按鈕
           }
   },
19. cls:"x-btn-text-icon",//添加表徵圖前需要設定該屬性
20. icon:"house.gif", //表徵圖的地址
21. plugins : Object/Array 擴充外掛程式時使用
22. repeat:false, //預設false ,如果為true,需要設定mouseover事件
23. renderTo:"Bind_Button" //將組件的顯示效果渲染到某個節點的ID

常用方法:
1. enable();啟用按鈕
2. disable();禁用按鈕
3. destroy();消滅按鈕
4. focus();按鈕擷取焦點
5. getText_r();擷取按鈕上的文本
6. hide();隱藏按鈕
7. show();顯示按鈕
8. setText( String text );設定按鈕上的文本
9. setVisible( Boolean visible );設定按鈕是否隱藏
10. buttonName.purgeListeners();
//使用該方法,意思是清除所有的監聽事件,所以當執行該句後就不會再執行listeners的click事件了。按鈕就不會被隱藏了。
11. buttonName.setHandler(fn);       
        //也可以通過這種方式設定handler事件:
        buttonName.setHandler(function(){Ext.Msg.alert('提示訊息框','測試Button組件:setHandler事件。');});
12. buttonName.on(eventName,fn);
       //下面的事件可以自己測試下
        buttonName.on("click",function(){
            Ext.Msg.alert('提示訊息框','測試Button組件:click事件。');
        });
         buttonName.on("mouseover",function(){
            Ext.Msg.alert('提示訊息框','測試Button組件:mouseover事件。');
        });

        buttonName.on("mouseout",function(){
            Ext.Msg.alert('提示訊息框','測試Button組件:mouseout事件。');
        });

             
mouseout : ( Button this, Event e ) ;
mouseover : ( Button this, Event e );
beforedestroy : ( Ext.Component this ) ;
beforehide : ( Ext.Component this ) ;
beforerender : ( Ext.Component this )
beforeshow : ( Ext.Component this )
click : ( Button this, EventObject e )
destroy : ( Ext.Component this )
disable : ( Ext.Component this )
enable : ( Ext.Component this )
hide : ( Ext.Component this )
show : ( Ext.Component this )
render : ( Ext.Component this )

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.