Ambasador
Ambasador

Reputation: 377

In xtype tagfield, the values sent to the server appear as a single combined line. Extjs

In the Ext.form.Panel component, I use the field:

....

{
                    xtype: 'tagfield',
                    fieldLabel: 'Установить сотрудников',
                    name: 'survey_users',
                    store: {
                        type: 'usertreestore'
                    },
                    reference: 'UserTreeStore',
                    displayField: 'text',
                    valueField: 'id',
                    filterPickList: true,
                    queryMode: 'remote',
                    publishes: 'value'
 },

....

I set the values for this field and send it to the update in the store.

The value of the field survey_users looks like one combined string "survey_users": 469473475463

but the right kind of values is 469,473,475,463

Below is the full form data when you submit.

[{"text":"\u0414\u0430\u0432\u044b\u0434\u043e\u0432 \u0410\u043b\u0435\u043a\u0441\u0435\u0439","id":"75","survey_users":469473475463,"survey_cofficient":2,"parentId":"73"}]

In the controller, the save method looks like this: ... saveUserData: function(button, e) {

    var values;        
    var form    = button.up('form');
    record = form.getRecord();
    store = this.getUserTreeStoreStore('UserTreeStore');
    values = form.getValues();
    id = form.getRecord().get('id');
    values.id=id;
    record.set(values);
    console.log(record)
    store.sync();

},

...

Before setting the values ​​in the record, it is clear that the values ​​are and they are in the correct format, but after setting the values ​​in the record field survey_users: NaN

I bring a screen output in the console enter image description here

How to make sure that when submitting a form, the values of the survey_users field were sent in the correct format?

Upvotes: 0

Views: 410

Answers (1)

beso9595
beso9595

Reputation: 1174

Try encodeSubmitValue

Here's the FIDDLE

Network:
enter image description here

Upvotes: 2

Related Questions