我的窗體上有組合框存在問題。 問題是,當我加載表單數據(與form.loadRecord
)有時組合框是空的,即使我知道該模型有數據。ExtJs組合框存儲裝載和表單
當我查看Firebug時,可以看到組合框存儲在加載記錄後加載。我認爲這是其原因 - 組合框存儲在稍後加載,然後記錄被加載。
這是我如何設置組合框專賣店:
//All stores have autoload:true configuration.
var possessionGroundsStore = Ext.create('path.to.store');
var vehicleTypesStore = Ext.create('path.to.store');
var usePurposesStore = Ext.create('path.to.store');
this.editView = Ext.create('path.to.view');
this.editView.getPossessionGroundsField().store = possessionGroundsStore;
this.editView.getVehicleTypeIdComboBox().store = vehicleTypesStore;
this.editView.getUsePurposeField().store = usePurposesStore;
//later
this.editView.loadRecord(record);
有沒有辦法解決這個問題的常用方法?
我現在看到的唯一方法是在每個組合框 中使用store.load
回調,然後在加載所有商店後執行loadRecord,但看起來很複雜。
任何幫助?
UPDATE: 當form.loadRecord
把它叫做內部調用field.setValue()
。 所以,重點是:在調用setValue
之前,組合框必須被填充。 如果商店沒有加載,您將看到valueField
而不是displayField
。
Try with triggerAction:'all'for combobox property – AJJ