Andrei Nicusan
21 Nov 2011, 12:17 AM
Hi, everybody!
I want to load an array of strings in a store, using a model. The problem here is that I don't know how to configure the model, especially its field set, so that I can have the strings in there (one string per model instance). When dealing with POJOs serialized to JSON, it is pretty straightforward, because I know how the fields of that POJO are called.
Let me show you two examples that may reveal the difference:
1.
serializing an array of KeyValueDTOs:
[{key : "key1", value : "value1"},
{key : "key2", value : "value2"}]
In the corresponding ExtJS model I have: ...fields : ['key', 'value'] and everything works fine when loading into the associated store.
2.
serializing an array of strings:
["S1", "S2"]
I need such string lists to be data providers for some combo boxes.
What's the right model configuration for this??? There's no field I can map. It seems to be something that common to get a list of strings from the server that I expect it to be supported somehow in the ExtJS MVC approach. Maybe it's too much in plain sight for me to find it.
Thank you in advance.
I want to load an array of strings in a store, using a model. The problem here is that I don't know how to configure the model, especially its field set, so that I can have the strings in there (one string per model instance). When dealing with POJOs serialized to JSON, it is pretty straightforward, because I know how the fields of that POJO are called.
Let me show you two examples that may reveal the difference:
1.
serializing an array of KeyValueDTOs:
[{key : "key1", value : "value1"},
{key : "key2", value : "value2"}]
In the corresponding ExtJS model I have: ...fields : ['key', 'value'] and everything works fine when loading into the associated store.
2.
serializing an array of strings:
["S1", "S2"]
I need such string lists to be data providers for some combo boxes.
What's the right model configuration for this??? There's no field I can map. It seems to be something that common to get a list of strings from the server that I expect it to be supported somehow in the ExtJS MVC approach. Maybe it's too much in plain sight for me to find it.
Thank you in advance.