Sencha/Extjs rest call with all parameters

666 Views Asked by At

I'm using ExtJs 5.1.1 and I've written a simple view with a grid, and selecting one row the corresponding model property are editable in some text fields. When editing is completed the button 'save' call Model.save() method, which use the rest proxy configured to write the changes on the server.

The call made by the proxy are two, first is OPTIONS call to know which method are allowed, second call is a PUT. My problem is PUT json contains only the changed attributes. I would like that my application sends all the attributes in PUT, instead only the changed subset.

Is this a proxy configuration, or should I use another kind of proxy, like ajax?

Some code snippet:

Model:

Ext.define('myApp.model.CvModel', {
    extend: 'Ext.data.Model',
    alias: 'viewmodel.cv',  

    idProperty : 'code',
    proxy: {
        type: 'rest',

        url: 'http://localhost:8080/CV/resource/rest/cvs/CodeSystem/Domain',
        paramsAsJson: true,
        reader: {
            type: 'json',
            rootProperty: 'Test_data'
        }

    },


    fields: [{
        ...

Controller:

onSave: function () {
            var selCv = this.getViewModel().get('selectedCv');
            selCv.save();
            ....
1

There are 1 best solutions below

1
On BEST ANSWER

You need to specify a writer config on your proxy with writeAllFields: true. By default it's false, and the default writer itself is just {type: 'json'}.