PDA

View Full Version : Design combo with ArrayStore - (cannot read property autoCreate - lack of 'field'?)



RobWilson
24 Dec 2010, 1:56 AM
When I create a new ArrayStore in the designer, I set the data to


[
[1,"T+1"],
[2,"T+2"],
[3,"T+3"],
[4,"T+4"],
[5,"T+5"],
[6,"T+6"],
[7,"T+7"],
[8,"T+8"],
[9,"T+9"],
[10,"T+10"]
]

I set the class to 'SettlementStore' and the store id to 'SettlementStoreId' and the idIndex to 1 (presumably this should show T+1..T+10 in the combo).

When I associate the combo box to use the SettlementStoreId, I get the error

Uncaught TypeError: Cannot read property 'autoCreated' of undefined

All I can think of, is that in examples where it's coded by hand, you specify the 'fields', but within the designer there is no option to do that.

What could I be missing, or is this a limitation in the designer? - What would a workaround be, i.e. creating the store in code and then how to assign to the generated ui code.

Many thanks,
Rob.

Condor
24 Dec 2010, 2:05 AM
1. You probably want idIndex:0 (I assume the identity field is the number and not the text).

2. Cannot read property 'autoCreate' of undefined is an error from the combobox and not of the store. How exactly are you setting up this combobox?

RobWilson
24 Dec 2010, 2:33 AM
Hi Condor,

Thank you for your quick reply.

The combo is created mostly with defaults, but I've entered the class name, store ID and associated it to the array data store.

The hiearchy is

viewport -> panel (card layout) -> panel -> form -> fieldset -> combo

Is this enough to help, or should I try to re-create in a small sample project?

Cheers,
Rob.

Condor
24 Dec 2010, 2:40 AM
Did you set the 'transform' config option?

RobWilson
24 Dec 2010, 2:53 AM
Nope - I feel like I'm missing something? ;-) Are you saying I need to do a transform of some sort on the combo?

What's the deal with the missing 'fields' parameter?

Cheers,
Rob.

Condor
24 Dec 2010, 2:59 AM
An ArrayStore with local data needs to be configured with 'fields' and 'data', e.g.

fields: ['value', 'text'],
idIndex: 0,
data: [[1, 'One'], [2, 'Two'], [3, 'Three']]

RobWilson
24 Dec 2010, 3:12 AM
That was my original point - how do you set the fields in the designer? I can't see the attributes in the ArrayStore.

If I type 'field' in the property inspector, to filter the attributes displayed, it only shows sortField ... so How can I specify the fields attribute through designer, or a workaround for an alternative?

What was the reference to transforming - was that related to your fields reply?

Thanks,
Rob.

Condor
24 Dec 2010, 3:41 AM
I don't use the Designer, so I had to fire it up for this question...

Right click on the store and select Add fields.

RobWilson
24 Dec 2010, 4:23 AM
Ah! A context menu, I didn't even know there were any - it's not obvious ;)

Thank you!

RobWilson
5 Jan 2011, 8:46 AM
My problem turned out to be that I forgot to add the new <JavaScript> import in my HTML file (doh!), but you tips about adding fields were still required.

Thanks Codor,
Rob.