ExtJS4 Ext Direct form loading with array named fields

105 views Asked by At

I have fields like this (for example only one):

Ext.create("Ext.form.Number", {
    name: "field[]",
    allowDecimals: true
});

...and I can post nice values. But when I'm trying to load values (form.load({params: {id: 1}})), it returns failure, and doesn't load the values to the fields.

Returned ajax values like this:

{
    "type": "rpc",
    "tid": 2,
    "action": "MyAction",
    "method": "getFormData",
    "result": {
        "field":["5"]
    }
}

Can you help me, what should I do? Form can't load array values to array fields?

1

There are 1 answers

0
Lorenz Meyer On

Array is not a valid type for fields. How would you expect this to work ? ExtJs stores are like tables in a database, model are like the rows.

As you cannot save an array into a field in mysql, you cannot in a field of an ExtJs model either.

You have to model your data differently in two tables instead of one ( main table and details table ). Do it the same way as you would in a database.