2014-11-05 2 views
1

기본 유형이 버튼 인 경우 toggleGroup의 값을 가져 오는 방법. allowblank : false도 작동하지 않습니다.Ext JS - 기본 유형이 버튼 일 때 toggleGroup의 값을 얻습니다.

의 ExtJS 5.x의에서
{ 
     xtype:'radiogroup', 
     fieldLabel: 'What is your title?', 
     layout:'hbox', 
     allowBlank:false, 
     defaultType: 'button',  
     id: 'titleSel', 
     defaults: { 
      enableToggle: true, 
      toggleGroup: 'titleGroup', 
      allowDepress: false, 
      width: '16.56%', 
      name: 'title', 
     },      
     items: [ 
      {text: 'Mr', value: 'Mr', inputValue: 'sfsf'}, 
      {text: 'Mrs', value: 'Mrs'}, 
      {text: 'Madam', value: 'Madam'}, 
      {text: 'Ms', value: 'Ms'}, 
      {text: 'Dr', value: 'Dr'}, 
      {text: 'Prof', value: 'Prof'},   
      ], 
     }, 
+0

RadioGroup에서 getChecked()를 사용해 보셨습니까? –

+0

getChecked()가 값을 반환하지 않습니다. 제거 할 때 제출 버튼 - defaultType : 'button'에서 값을 얻을 수 있습니다. 기본적으로 라디오 모양을 단추로 변경하려고합니다. –

+0

Ext.getCmp ('titleSel'). getChecked() - 아무 값도 반환하지 않습니다. –

답변

0

... 당신은 클래스 Ext.container.ButtonGroup를 확장 한 후 전달 된 이름이나 ID를 유도 할 수있는 사용자 정의 변경 이벤트 리스너 ...에 버튼 '기본 처리기를 바인딩해야합니다.

Ext.define('SomeApp.view.toggle.Titles', { 
    extend: 'Ext.container.ButtonGroup', 
    alias: ['widget.ToggleTitles'], 
    frameHeader: true, 
    title: false, 
    columns: 6, 
    width: 300, 
    height: 46, 
    border: 0, 

    defaults: { 
     enableToggle: true, 
     toggleGroup: 'titles', 
     handler: function(){ 
      this.up('buttongroup').fireEvent('change', this.name.replace('btn', '').toLowerCase()); 
     } 
    }, 

    items: [ 
     {tabIndex: 1, name: 'btnMr', text: 'Mr', pressed: true}, 
     {tabIndex: 2, name: 'btnMrs', text: 'Mrs'}, 
     {tabIndex: 3, name: 'btnMadam', text: 'Madam'}, 
     {tabIndex: 4, name: 'btnMs', text: 'Ms'}, 
     {tabIndex: 5, name: 'btnDr', text: 'Dr'}, 
     {tabIndex: 6, name: 'btnProf', text: 'Prof'} 
    ], 

    listeners: { 
     change: function(value){ 
      ... 
     } 
    } 

}