PDA

View Full Version : Beginners Problem with stores and comboboxes :-(



ahsec
17 Apr 2012, 8:48 AM
Hi everybody...I've started using the EXTDesigner to build my GUI.
my first step was trying to build a combobox and load a static(local) data into it.
here is my combobox on EXT Designer
34114


as you can see it's very simple..the problem starts..well..when I'm trying to add data to the store..
I've tried to use both array store and array store..neither worked...
when I add , say, six rows to the data of the store, this is the result
34115

I get six empty rows!!!!!

this is what I have in my data box in EXTDesigner forthe store:
[{age:10},{age:10},{age:10},{age:10},{age:10},{age:10}]

and the field has in the "name" box: age , and in the type box: int.

it clearly seems that the box gets the data yet can't find any of the fields...any ideas?

here's my code in the store file generated (exported) by the designer:


Ext.define('MyApp.store.d_AppsStoreArr', {
extend: 'Ext.data.Store',


constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
storeId: 'd_AppsStoreArr',
clearOnPageLoad: false,
data: [
{
age: 10
},
{
age: 10
},
{
age: 10
},
{
age: 10
},
{
age: 10
},
{
age: 10
}
],
proxy: {
type: 'ajax',
reader: {
type: 'array'
}
},
fields: [
{
name: 'age',
type: 'int'
}
]
}, cfg)]);
}
});

scottmartin
17 Apr 2012, 8:58 AM
Do you have name: 'age' defined for your combo? also look at valueField,displayField if needed

Regards,
Scott.

ahsec
17 Apr 2012, 9:30 AM
Hi Scott,
Thank you so much for your reply, I just did, and yet it still doesn't work...
here are my "related-to-store" config's in the combo box:(exactly as they're filled in the designer)
name:age
store:d_alertsNumStore
displayField: int (as the value for age is 10)
queryMode:Local (as the store is a static)
valueField:age

at form.field.Field:
name:age
value(as default..unfilled)

and now the store has:(in the designer)
data:[{age:10},{age:10},{age:10},{age:10},{age:10},{age:10}]

I can't think of anything that's closer...
(I have finally managed to work the bar chart out but couldn't conclude from it to the combo box...)


Thanks :-)

ahsec
17 Apr 2012, 9:33 AM
for the record, I also tried 'age' instead of age in valueField and Name

ahsec
17 Apr 2012, 9:41 AM
Got it!!! displayField should have been age as well :-)

Thanks!!!!

scottmartin
17 Apr 2012, 9:44 AM
Have a look at the following online example and see if you can find a difference:

demo:
http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/form/combos.html
code:
http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/form/combos.js

Please report back.

Scott.

ahsec
18 Apr 2012, 12:23 AM
Hi Scott.
Honestly, when trying to solve that issue, I mainly focused on the Store's fields rather than the component's. there was indeed no difference between the component's structure and fields . However, what did surprise me was that the Store generated by the designer had a different code structure than what the example you referenced me to did.

Thanks again!!!