PDA

View Full Version : Combobox Store is empty?!



slsb02
13 Oct 2012, 12:17 PM
Hello,

i have a question... The Combobox Store is empty, why?



Function:
var tax_classes_DataStore = new Array(); tax_classes_DataStore['data'] = new Array();
function function_tax_classes_DataStore(mainWindow) {
tax_classes_DataStore = Ext.create('Ext.data.Store', {
extend: 'Ext.data.Model',
fields: [
{name: 'tax_class_id', type: 'int'},
{name: 'tax_standard', type: 'string'},
{name: 'tax_rate', type: 'decimal'},
{name: 'name', type: 'string'},
],
proxy: {
actionMethods: { create: 'POST', read: 'POST', update: 'POST', destroy: 'POST' },
extraParams: { task: "get_db_tax_classes" },
type: 'ajax',
url : LoadDataHelperFile,
reader: {
type: 'json',
root: 'results',
totalProperty: 'total',
},
listeners: {
exception: function(proxy, response, operation) {
response = Ext.JSON.decode(response.responseText, true);
get_Proxy_Error_msg_box(response, "get_db_tax_classes", "load");
Ext.getCmp('PRODNew-addNewWindow').close();
}
}
}
}).load();
}

call Function:
if (tax_classes_DataStore.data.length <= 0) { function_tax_classes_DataStore('PRODNew-addNewWindow'); }


The Combox is add to a form. Select the Combobox the Store ist empty? When I look up the Store on the end of the function, the store is not empty...

vietits
13 Oct 2012, 3:55 PM
It's hard to say without looking at your combobox code.

slsb02
14 Oct 2012, 8:26 PM
Hello,

here is my combobox code:



PRODNew_combo_products_tax_class = new Ext.form.ComboBox({
id: 'PRODNew-combo-products-tax-class',
name: 'PRODNew-combo-products-tax-class',
fieldLabel: PROD_PRODUCTS_TAX_CLASS,
store: tax_classes_DataStore,
queryMode: 'local',
displayField: 'name',
valueField: 'tax_class_id',
editable: false,
emptyText: PROD_PRODUCTS_TAX_CLASS_ET,
listConfig: {
loadingText: DATA_LOAD_MASK_MESSAGE,
}
});

vietits
15 Oct 2012, 7:35 PM
Have you checked tax_classes_DataStore at the time of creating of combobox? Is it a store instance or just an array? I also wonder why you initialized tax_classes_DataStore as an array and don't create and assign store to it.