2012-04-19 2 views
0

확인란에 checkevent를 수행하는 데 도움이 필요합니다.checkevent 확인란을 어떻게 수행합니까?

View.js :

Ext.define('AM.view.shop.Bill', 
{ 
    extend: 'Ext.form.Panel', 
    alias : 'widget.bil', 
    title: 'Complete Check Out', 
    defaultType:'textfield', 
    initComponent: function() { 

    this.items= [ 
    // Mailing Address 
    { xtype: 'fieldset', 
     title: 'Mailing Address', 
     defaultType: 'textfield', 
     layout: 'anchor', 
     width:520, 
     defaults: { 
     anchor: '100%' 
    }, 

    items: [{ 
     fieldLabel: 'Street Address', 
     name: 'mailingStreet', 
     billingFieldName: 'billingStreet', 
     allowBlank: false 
    }, 

    { xtype: 'container', 
     layout: 'hbox', 
     items: [{ 
      xtype: 'textfield', 
      fieldLabel: 'City', 
      name: 'mailingCity', 
      id:'mailingCity', 
      billingFieldName: 'billingCity', 
      flex: 1, 
      allowBlank: false 
     }] 
    }] 
}, 

// Billing Address 
{ 
    xtype: 'fieldset', 
    title: 'Billing Address', 
    layout: 'anchor', 
width:520, 
    defaults: { 
     anchor: '100%' 
    }, 
    items: [{ 
     xtype: 'checkbox', 
     name: 'billingSameAsMailing', 
     boxLabel: 'Same as Mailing Address?', 
     hideLabel: true, 
     checked: true, 
     style: 'margin-bottom:10px', 
     id:'billingSameAsMailing', 
    }, 

    { xtype: 'textfield', 
     fieldLabel: 'Street Address', 
     name: 'billingStreet', 
     //style: 'opacity:.3', 
     disabled: true, 
     allowBlank: false 
    }, 

    { xtype: 'container', 
     layout: 'hbox', 
     items: [{ 
      xtype: 'textfield', 
      fieldLabel: 'City', 
      name: 'billingCity', 
      id:'billingCity', 
      style: (!Ext.isIE6) ? 'opacity:.3' : '', 
      flex: 1, 
      disabled: true, 
      allowBlank: false 
      }] 
     }] 
    }] 

    this.callParent(arguments); 
    } 
}); 

controller.js : 여기 내 코드입니다

Ext.define('AM.controller.Shops', { 
    extend: 'Ext.app.Controller', 
    init: function() { 
     this.control({ 
      'bil textfield[name=mailingCity]' : { 
       change: function(textField) { 
        var formpanel = Ext.ComponentQuery.query('bil')[0]; 
        var copyToBilling = formpanel.down('[name=billingSameAsMailing]').getValue(); 

        if (copyToBilling) {  
         var city=formpanel.down('[name=mailingCity]').getValue(); 
         formpanel.down('[name=billingCity]').setValue(city); 
        }  
       }  
      }, 

      'bil checkbox[name=billingSameAsMailing]': { 
       check: function(item, checked) { 
        alert(item); 
       } 
       }      
      }); 
    } 
}); 
내가 텍스트 상자 같은 방법을 사용하여이 수행하는 특정 체크 박스를 얻을 수 있습니다 이벤트는
입니다. 텍스트 상자에서 제대로 작동하지만 확인란의 경우 응답하지 않습니다.

답변

0

다음 코드를 사용해보세요. 저에게 도움이됩니다.

item.checked = true; 
관련 문제