1. 程式人生 > >extjs下拉列表 聯動

extjs下拉列表 聯動

原文地址:http://stargazer0926.blog.163.com/blog/static/882362562010816112357187/


概述:  RadioGroup內含多個Radio,每個Radio.name必須相同,選中事件RadioGroup不提供,Radio子元件自行處理
功能:  選擇一個Radio,動態載入GridPanel.

new Ext.form.RadioGroup({
//fieldLabel : "資料選擇",    //RadioGroup.fieldLabel 標籤與 Radio.boxLabel 標籤區別
       hideLabel : true,   //隱藏RadioGroup標籤


       items : [
                  new ({                          //三個必須項
                               checked : true,                       //設定當前為選中狀態,僅且一個為選中.
boxLabel : "書籍借閱",        //Radio標籤
 name : "borrow",                   //用於form提交時傳送的引數名
inputValue : "book",              //提交時傳送的引數值
listeners : {

                                     check : function(checkbox, checked) {        //選中時,呼叫的事件
                                                             if (checked) {
                                                                      borrow_grid.reconfigure(book_store,book_cm);  //動態重新載入GridPanel
                                                                      book_store.load();

                                                             }
                                                  }
                               }
                   }), 
                   new Ext.form.Radio({            //以上相同
          boxLabel : "期刊借閱",
          name : "borrow",
          inputValue : "magazine",
          listeners : {
           check : function(checkbox, checked) {
            if (checked) {
             borrow_grid.reconfigure(magazine_store,magazine_cm);
             magazine_store.load()
            }
           }
          }
         }), new Ext.form.Radio({
          boxLabel : "標準借閱",
          name : "borrow",
          inputValue : "standard",
          listeners : {
           check : function(checkbox, checked) {
            if (checked) {
             borrow_grid.reconfigure(
               standard_store,
               standard_cm);
             standard_store.load();
            }
           }
          }
         })]
      })