2012-04-04 37 views
0

ProductStore包括幾個產品及其說明。 產品項目我從組合中選擇,從textarea的描述。ExtJS的負荷記錄到形式

我如何可以加載它們放回形式(組合,文本區域)。

在此先感謝

回答

1

我假設組合是從存儲加載,以便在組合框中有產品的ID。從組合框中選擇一個產品時,將一個監聽器放在組合框上獲取其ID。在商店中查找身份證並獲取記錄。記下這個記錄並獲取你需要的數據並用它填充字段。以下是您需要將其適用於您的代碼的基本想法。

var productId = combo.getValue(); //the id from the selected product in the combo box. 
var rec = store.getById(productId); 
//You can also use rec.get('description'); 
var desc = rec.data.description; 
var productName= rec.data.name; 
var id= rec.data.id; 
//Now take these values and use them to fill in your form 
textField.setValue(desc);