extjs

comboBox+checkBox:

 

Ext.onReady(function(){ 
    var store= new Ext.data.SimpleStore({
         fields:['industryName','industryValue'],
         data:[['标杆,,'1'],['标杆,'2'],['标杆3',3],['标杆4',4]]
     });
    
    var comboas = new Ext.form.ComboBox({
        id:'comboaa', 
        store: store,  
        fieldLabel: '标杆了',
        displayField:'industryName',  
        valueField:'industryValue',  
        typeAhead: true,  
        mode: 'local',  
        //tpl:'<tpl for="."><div ><span><input type="checkbox" οnclick="myclick(this)" value="{state}" /></span><span class="x-combo-list-item">{state}</span></div></tpl>',  
        tpl:'<tpl for="."><div class="x-combo-list-item"><span><input type="checkbox" {[values.check?"checked":""]}  value="{[values.industryName]}" /></span><span >{industryName}</span></div></tpl>',  
        triggerAction: 'all',  
        emptyText:'select...',  
        selectOnFocus:true,  
        //applyTo: 'local-states',  
        onSelect : function(record, index){  
            if(this.fireEvent('beforeselect', this, record, index) !== false){  
                record.set('check',!record.get('check'));  
                var str=[];//页面显示的值  
                var strvalue=[];//传入后台的值  
                this.store.each(function(rc){  
                    if(rc.get('check')){  
                        str.push(rc.get('industryName'));  
                        strvalue.push(rc.get('industryValue'));  
                    }  
                });  
                this.setValue(str.join());  
                this.value=strvalue.join();  
                //this.collapse();  
                this.fireEvent('select', this, record, index);  
            }  
        }  
    }); 
 
   var sp = new Ext.form.FormPanel({
           //renderTo: Ext.getBody(),
           id:'asa',
     labelAlign:'right',
     buttonAlign:'right',
     border:true,  //True表示为显示出面板body元素的边框,false则隐藏(缺省为true).
     frame:true,
     title:'查询条件',
     autoHeight:true,
     collapsible:true, //面板是可收缩的
      items:[{
        layout:'column',
     bodyStyle: 'width:100%',
        items:[{
          columnWidth:.5,
          layout:'form',
          items:[comboas]
        },{
              columnWidth:.5,
              layout:'form',
              items:[{}]
        }]
      }]
   
    });  
        
      comboas.render(Ext.getBody());
     
   });

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值