2012-06-05 52 views
1

我有一個相關的組合框是必需的。當選擇父組合框值時,相關的組合將被清除,並重新加載存儲。如何在重新加載期間保持顯示ExtJs驗證錯誤?如何在重新加載期間禁用ExtJs驗證錯誤?

  new Ext.form.ComboBox({ 
       id: 'ddlMake', 
       store: makeStore, 
       displayField: 'Description', 
       valueField: 'TypeCode', 
       width: 110, 
       typeAhead: true, 
       mode: 'local', 
       forceSelection: true, 
       triggerAction: 'all', 
       emptyText: 'Select a make', 
       selectOnFocus: true, 
       allowBlank: false, 
       listeners: 
        { 
         select: function (combo, record, index) { 
          var selVal = Ext.getCmp('ddlMake').getValue(); 
          var modelCombo = Ext.getCmp('ddlModel'); 
          modelCombo.setValue(''); 
          modelCombo.store.reload({ 
           params: { categoryTypeCode: 'MODEL', subCategoryTypeCode: selVal } 
          }); 
         } 
        } 
      }), 
      new Ext.form.ComboBox({ 
       id: 'ddlModel', 
       store: modelStore, 
       displayField: 'Description', 
       valueField: 'TypeCode', 
       width: 110, 
       typeAhead: true, 
       mode: 'local', 
       forceSelection: true, 
       triggerAction: 'all', 
       emptyText: 'Select a model', 
       selectOnFocus: true, 
       allowBlank: false 
      }), 

回答

3

Reset()方法將清除任何驗證消息。以下是我最終使用:

function LoadModelCombo(combo, record, index) { 
    var selVal = Ext.getCmp('ddlMake').getValue(); 

    if (selVal != '') { 
     var modelCombo = Ext.getCmp('ddlModel'); 
     modelCombo.setValue(''); 
     modelCombo.store.reload({ 
      params: { categoryTypeCode: 'MODEL', subCategoryTypeCode: selVal } 
     }); 
     modelCombo.reset(); 
    } 
} 
+0

你不需要重新設置,你可以暫時allowblank設置爲true負載之前,當存儲加載設置爲false – ncank

+0

嘿感謝您的提示 –

1

我沒有確切的代碼,但也有方法來壓制其他聽衆 - 參見stopEvent和stopPropogation文檔。