View Full Version : How to send action parameter into Proxy?

16 Jun 2011, 7:16 AM
My application is using Ext.data.Proxy to handle local storage. I found both store.remove(records) and record.save() will trigger update event in my Proxy. Moreover I need to use different sql query to update my records under different scenarios. Those update condition checks are set in the update function too. Can any one tell me how to send an extra action parameter into the Proxy? Thanks

My Data Structure is like the following:


app.models.myModel = Ext.regModel('app.models.myModel', {
fields: [
{name: 'id', type: 'string'},
{name: 'name', type: 'string'},
{name: 'type', type: 'string', defaultValue: 's'},
{name: 'createDate', type: 'date'},
{name: 'status', type: 'string'}

associations: [
{type: 'hasMany', model: 'item', name: 'items'}

proxy: {type: 'app.db.MyLocalDB'}

app.stores.myStore = new Ext.data.Store({
model: 'app.models.myModel',
sorters: 'createDate'

Ext.data.ProxyMgr.registerType('app.db.MyLocalDB', Ext.extend(Ext.data.Proxy, {

constructor: function(config) {

this.db = openDatabase('mydb', '1.0', 'mydb', 65536);

config = config || {};

if (config.model == undefined) {
delete config.model;

Ext.data.Proxy.superclass.constructor.call(this, config);

if (this.model != undefined && !(this.model instanceof Ext.data.Model)) {


create: function(operation, callback, scope) {


read: function(operation, callback, scope) {


update: function(operation, callback, scope) {
console.log('Proxy update is called. Action is ' + operation.action);

// Use different sql query to handle updates and records removal


destroy: function(operation, callback, scope) {

console.log('Proxy destroy is called');


}));One example action in front end: