Note that there are some explanatory texts on larger screens.

plurals
  1. POExtjs Restful Store, Sending request in Batch?
    primarykey
    data
    text
    <p>I created a Grid component with the store configuration like this:</p> <pre><code> //Create the store config.store = new Ext.data.Store({ restful: true, autoSave: false, batch: true, writer: new Ext.data.JsonWriter({ encode: false }), reader: new Ext.data.JsonReader({ totalProperty: 'total', root: 'data', fields: cfg.fields }), proxy: new Ext.data.HttpProxy({ url:cfg.rest, listeners:{ exception: { fn: function(proxy, type, action, options, response, arg) { this.fireEvent('exception', proxy, type, action, options, response, arg); }, scope: this } } }), remoteSort: true, successProperty: 'success', baseParams: { start: 0, limit: cfg.pageSize || 15 }, autoLoad: true, listeners: { load: { fn: function() { this.el.unmask(); }, scope: this }, beforeload: { fn: function() { this.el.mask("Working"); }, scope: this }, save: { fn: function(store, batch, data) { this.el.unmask(); this.fireEvent('save', store, batch, data); }, scope: this }, beforewrite: { fn: function(){ this.el.mask("Working..."); }, scope: this } } }); </code></pre> <p>Note: Ignore the fireEvents. This store is being configured in a shared custom Grid Component.</p> <p>However, I have one problem here: Whatever CRUD actions I did, I always come out with N requests to the server which is equal to N rows I selected. i.e., if I select 10 rows and hit Delete, 10 DELETE requests will be made to the server.</p> <p>For example, this is how I delete records:</p> <pre><code>/** * Call this to delete selected items. No confirmation needed */ _deleteSelectedItems: function() { var selections = this.getSelectionModel().getSelections(); if (selections.length &gt; 0) { this.store.remove(selections); } this.store.save(); this.store.reload(); }, </code></pre> <p>Note: The scope of "this" is a Grid Component.</p> <p>So, is it suppose to be like that? Or my configuration problem? I'm using Extjs 3.3.1, and according to the documentation of <code>batch</code> under Ext.data.Store,</p> <blockquote> <p>If Store is RESTful, the DataProxy is also RESTful, and a unique transaction is generated for each record.</p> </blockquote> <p>I wish this is my configuration problem.</p> <p><em>Note: I tried with <code>listful</code>, <code>encode</code>, <code>writeAllFields</code>, <code>encodeDelete</code> in <code>Ext.data.JsonWriter</code>... with no hope</em></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload