The configuration itself is described here in the docs. But it looks like you have the correct syntax.
The first thing you should know is that this configuration only applies to proxies that extend Ext.data.proxy.Server . Read the "Proxy Types" section here .
By defining different URLs in this configuration, you simply indicate in the repository where to send the ajax request to perform various CRUD actions on your server side.
For example, calling store.load() will send an ajax request to api.read URL, you need to make sure that this URL returns the data correctly.
An Ext.data.Store internally tracks other actions performed on dirty records (created, updated, or destroyed). Based on this, it will send an ajax request to the corresponding api configuration url. Or if you performed various types of actions, for example. created and deleted entries, it will send more than one ajax request (one for each URL) along with data about the entries you created or deleted.
Here is an example code to illustrate (which you can also use for testing if you fill in your own URLs and data.model ). In this example, the default reader / writer is used, which sends data to the server as JSON (the proxy server has settings for specifying a different format).
var myStore = Ext.create('Ext.data.Store', { model: 'MyApp.model.SomeModel', proxy: { type: 'ajax',
Two other useful information about this:
There is a proxy configuration called batchActions , described here in the docs . By default, this is true , which means that all CRUD actions of a certain type are grouped into an array when sending a request to the database. For instance. if you deleted 4 entries, api.destroy url will not receive 4 ajax requests, it will receive 1 ajax with an array of 4 entries. This helps reduce network traffic while you configure your URL to process the array. You can set this configuration to false , and the store will send 4 instead requesting the api.destroy URL. You can also set the allowSingle config writer ( described here ) to ensure that all requests are sent as an array, even if there is only one entry (this way you can always configure your server-side code to process the array).
Ext.data.Store configured to handle a callback to create and update actions, you just need to make sure your URL is sent back. When you call myStore.sync() , the store will automatically replace the client-side entry with the one you send in your Chime. This is useful for the created records, because you can send back the correct database identifier with the created record and get it available on the client side, later if the user wants to change or delete the record with which you have the correct database identifier. You can also do other processing on the server side and send back other data so that you have a complete record (for example, I sometimes send back to create a user ID and create time).
source share