O'Reilly logo

Learning Ext JS 4 by Armando Gonzalez, Crysfel Villa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending data

Once we have added, modified, or even deleted our original data we should send our changes to our server. The Ext allows us to do that by using a writer to encode our data to the right format. We have two types of writers available, for JSON and XML format.

Let's modify our store class and define a JSON writer to our proxy:

Ext.define('MyApp.store.Invoices',{
extend  : 'Ext.data.Store',
model  : 'MyApp.model.Invoice',

  //Ajax proxy with JSON reader and writer
proxy  : {
    type  : 'ajax',
    url    : 'serverside/invoices.json',
    reader  : {
      type  : 'json',
      root  : 'data'
    },
    writer  : {
      type  : 'json',
      allowSingle  : false
    }
    }
});

By setting a writer property we can define the type of format to encode our data. In this case we are setting json in the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required