View Full Version : Prevent post on insert as in rest proxy example

22 Feb 2012, 8:03 PM

In the rest proxy example clicking add does not automatically generate post event. Why is this? I would like to achieve the same but when I insert into the store it automatically posts.

Here is my code


Ext.define('noclash.controller.ResourceFieldController', { extend: 'Ext.app.Controller',
stores: 'ResourceFields',
models: 'ResourceField',

refs : [
{ref: 'ResourceFieldsGrid', selector: 'ResourceFieldsGrid'}

init : function() {
console.log('initialized resourcefieldcontroller');
'ResourceFieldsGrid button[action=add]' : {
click: this.addResourceField

addResourceField : function() {
console.log('add clicked');
grid = this.getResourceFieldsGrid();
var plugin=grid.getPlugin('fieldEditor');
store = this.getResourceFieldsStore();
store.insert(0, new this.getResourceFieldModel());
plugin.startEdit(0, 0);


Ext.define('noclash.store.ResourceFields' , { extend: 'Ext.data.Store',
requires: 'noclash.model.ResourceField',
model: 'noclash.model.ResourceField',
autoLoad: true,
autoSync: true,

proxy: {
type: 'rest',

url: 'app/data/services.php',
extraParams: {
xsource: 'resourceInfoStore',
ResourceType: 1

reader: {
type: 'json',
root: 'results'
writer: {
type: 'json'
listeners: {
write: function(store, operation){



23 Feb 2012, 7:39 AM
If you are talking about the writer.html example, the reason is because the new record isn't valid until you fill in the email, first name and last name. The model has validations and to send a record in a create sync call the record must be a phantom and be valid.

24 Feb 2012, 12:02 AM
Ok great. How do I switch the question to answered?