Sending data

After adding, editing, or modifying records into the store, we should send the data to our server. Ext JS allows us to do this by the use of a writer property (it has to set in the proxy). This writer will encode the data depending on the type of writer (JSON or XML). In order to archive this, let's create the CustomersSending.js file in the path appcode/store/customers. We will use the previous models we have created and place the following code:

Ext.define('Myapp.store.customers.CustomersSending',{
  extend:'Ext.data.Store',
  model: 'Myapp.model.Customer',
  autoLoad:false,
  autoSync:true,
  proxy:{
    type:'ajax',
    url: 'serverside/customers.json',
    api: {
      read    : 'serverside/customers.json',
      create  : 'serverside/process.php?action=new',

Get Learning Ext JS - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.