2014-01-24 19 views
1

此處無線電組中的無線電字段通常基於先前的選擇進行選擇。即刷新頁面時,它會自動設置以前的值。但我需要清除廣播組的所有值。取消選中加載過程中的整個無線電廣播電臺字段4

this.mcmAdminServiceIndicatorsRadioGroup = new Ext.form.RadioGroup({ 
      width: 350, 
      height: 50, 
      items: [ 
       { 
        xtype: 'radiofield', 
        name: 'serviceIndicator', 
        fieldLabel: '', 
        inputValue: 'ADM', 
        boxLabel: 'ADM' 
       }, 
       { 
        xtype: 'radiofield', 
        name: 'serviceIndicator', 
        margin: '0 0 0 20', 
        fieldLabel: '', 
        inputValue: 'BCK', 
        boxLabel: 'BCK' 
       }, 
       { 
        xtype: 'radiofield', 
        name: 'serviceIndicator', 
        margin: '0 0 0 20', 
        fieldLabel: '', 
        inputValue: 'CKC', 
        boxLabel: 'CKC' 
       }, 
       { 
        xtype: 'radiofield', 
        name: 'serviceIndicator', 
        margin: '0 0 0 20', 
        fieldLabel: '', 
        inputValue: 'BRK', 
        boxLabel: 'BRK' 
       }, 
       { 
        xtype: 'radiofield', 
        name: 'serviceIndicator', 
        margin: '0 0 0 20', 
        fieldLabel: '', 
        inputValue: 'FMF', 
        boxLabel: 'FMF' 
       }    
      ] 
     }); 

上午試過其他無線電組件組的聽者內這三種方式..

this.mcmTaskCategoryRadiogroup = new Ext.form.RadioGroup({ 
      width: 205, 
      height: 50, 
      items: [ 
       { 
        xtype: 'radiofield', 
        name: 'type', 
        inputValue: 'Customer', 
        boxLabel: 'Customer', 
        checked: true 
       }, 
       { 
        xtype: 'radiofield', 
        name: 'type', 
        inputValue: 'Admin', 
        boxLabel: 'Admin' 
       } 
      ], 
      listeners: { 
       scope: this, 
       change: function(radiogroup, newValue, oldValue) { //will be trigger twice, one with both fields, and second with the new field 

        if(typeof(newValue.type) == 'string') { 
         if(newValue.type === 'Admin') { 
          this.mcmPassengerFieldSet.hide(); 
          this.mcmPassengerServiceIndicatorsFieldSet.hide(); 
          this.mcmAdminServiceIndicatorsFieldSet.show(); 
          this.mcmRequestTypeCombobox.store.loadData([{ name: 'Admin' }], false); 
          this.mcmRequestTypeCombobox.setValue('Admin'); 
          //this.mcmAdminServiceIndicatorsRadioGroup.setValue(false); 


//this.mcmAdminServiceIndicatorsRadioGroup.setValue({ serviceIndicator: taskType }); 


this.mcmAdminServiceIndicatorsRadioGroup.items.items[0].setValue(true); 
         } else if(newValue.type === 'Customer') { 
          this.mcmPassengerFieldSet.show(); 
          this.mcmPassengerServiceIndicatorsFieldSet.show(); 
          this.mcmAdminServiceIndicatorsFieldSet.hide(); 
          this.mcmRequestTypeCombobox.store.loadData([ 
           { name: '5Star' }, 
           { name: '5Key' }, 
           { name: 'Concierge Key' }, 
           { name: 'Focus Market' }, 
           { name: 'Sales' }, 
           { name: 'OA VIP' }, 
           // TCS:09-24-2013 modified 
           { name: 'JL VIP' }, 
           { name: 'BA VIP' }, 
           { name: 'IB VIP' }, 
           { name: 'QF VIP' }, 
           // modification ended 
           { name: 'Other' } 
          ], false); 
          this.mcmRequestTypeCombobox.setValue(
           this.mcmDisplayedRecord.get('RequestType') ? this.mcmDisplayedRecord.get('RequestType') : 'Other'); 
         } 
        } 
       } 
      } 
     }); 

回答

0

你試過去掉「檢查:真正的」從客戶radiofield?

David

+0

是的,我嘗試過。同樣的問題發生。 – Suresh

+0

是的,我試過不工作。 – Suresh

+0

@weeksdev請幫我.. – Suresh

0

我覺得這是Ext JS的一個bug。下面的代碼是「Ext.form.field.Field」類中存在的重置函數源代碼。

reset : function(){ 
    var me = this; 
    me.beforeReset(); 
    me.setValue(me.originalValue); 
    me.clearInvalid(); 
    // delete here so we reset back to the original state 
    delete me.wasValid; 

}

說明:

上述功能設定的字段的值作爲字段的實際原始值。對於除「無線電」之外的其他所有類型,這都工作正常。 「checked:false」設置也不起作用,即使radio的基類是「複選框」(對複選框工作正常)。

問題

我想選擇的無線電/ RadioGroup中的任何一個選項後出現的問題。無線電部件需要保持原來的值,但每當我們選中/取消選中,無線電部件的原始值就會改變。這就是重置功能無法重置收音機的原因。

哈克

我做了這個問題的破解。我正在維護另一個保存收音機原始值的密鑰,並且每當我調用重置功能時我都會手動設置該值。我已經覆蓋了上面的功能。

reset : function(){ 
    var me = this; 
    me.beforeReset(); 
    me.setValue(me.initialDefaultValue); 
    me.clearInvalid(); 
    // delete here so we reset back to the original state 
    delete me.wasValid; 

}

現在我可以創建一個單選按鈕,這樣的事情,即使你通過調用form.reset重置整個窗體值

{xype: 'radio', name: 'Test', initialDefaultValue: false, boxLabel: 'Hello'} 

上述解決方案將正常工作() 。

希望這個幫助..!

相關問題