neilios
11 Dec 2011, 10:38 AM
I am new to Ext4.0.
I have created a store, model and view for a table dataset on my server and am trying to figure out what Ext will sent to my server on a save.
What I'm seeing is that if I do a row edit and then click update then ALL records are send to the server. Similarly, if I use cellediting with autosync set to true then, again, ALL records are sent to the server.
Is this expected behavior?
I have very little configuration at this point. For RowEditing I have the following code:
Store:
Ext.define('MVRZ.store.Sources', {
extend: 'Ext.data.Store',
requires: 'MVRZ.model.Sources',
model: 'MVRZ.model.Sources',
storeId: MVRZGC.DATASET_SOURCE,
autoSync: false
});
Model:
Ext.define('MVRZ.model.Sources', {
extend: 'Ext.data.Model',
fields: MVRZ.Dataset.getFieldsList(MVRZGC.DATASET_SOURCE),
proxy: {
type: 'ajax',
noCache: true,
url: MVRZ.Dataset.getServerUrl(MVRZGC.DATASET_SOURCE),
reader: {
type: 'json',
root: 'results'
}
}
});
View:
Ext.define('MVRZ.view.SourcesList', {
extend: 'Ext.grid.Panel',
alias: 'widget.sourceslist',
title: 'Sources Grid',
store: 'Sources',
stateful: true,
stateId: 'sourcesListGrid',
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 2
})
],
viewConfig: {
stripeRows: true
},
initComponent: function() {
this.columns = MVRZ.Dataset.getColumnsList(MVRZGC.DATASET_SOURCE, {includeKey:false})
this.callParent();
}
});
Controller:
Ext.define('MVRZ.controller.Sources', {
extend: 'Ext.app.Controller',
refs: [{
ref: 'sourcesList',
selector: 'sourceslist'
}],
stores: ['Sources'],
init: function() {
// Start listening for events on views
this.control({
'sourceslist': {
selectionchange: this.onSourcesSelect
},
});
},
onLaunch: function() {
var sourcesStore = this.getSourcesStore();
sourcesStore.load({
callback: this.onSourcesLoad,
scope: this
});
},
onSourcesLoad: function() {
var sourcesList = this.getSourcesList();
sourcesList.getSelectionModel().select(0);
},
onSourcesSelect: function(selModel, selection) {
// Fire an application wide event
this.application.fireEvent('sourcesstart', selection[0]);
}
});
I have created a store, model and view for a table dataset on my server and am trying to figure out what Ext will sent to my server on a save.
What I'm seeing is that if I do a row edit and then click update then ALL records are send to the server. Similarly, if I use cellediting with autosync set to true then, again, ALL records are sent to the server.
Is this expected behavior?
I have very little configuration at this point. For RowEditing I have the following code:
Store:
Ext.define('MVRZ.store.Sources', {
extend: 'Ext.data.Store',
requires: 'MVRZ.model.Sources',
model: 'MVRZ.model.Sources',
storeId: MVRZGC.DATASET_SOURCE,
autoSync: false
});
Model:
Ext.define('MVRZ.model.Sources', {
extend: 'Ext.data.Model',
fields: MVRZ.Dataset.getFieldsList(MVRZGC.DATASET_SOURCE),
proxy: {
type: 'ajax',
noCache: true,
url: MVRZ.Dataset.getServerUrl(MVRZGC.DATASET_SOURCE),
reader: {
type: 'json',
root: 'results'
}
}
});
View:
Ext.define('MVRZ.view.SourcesList', {
extend: 'Ext.grid.Panel',
alias: 'widget.sourceslist',
title: 'Sources Grid',
store: 'Sources',
stateful: true,
stateId: 'sourcesListGrid',
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 2
})
],
viewConfig: {
stripeRows: true
},
initComponent: function() {
this.columns = MVRZ.Dataset.getColumnsList(MVRZGC.DATASET_SOURCE, {includeKey:false})
this.callParent();
}
});
Controller:
Ext.define('MVRZ.controller.Sources', {
extend: 'Ext.app.Controller',
refs: [{
ref: 'sourcesList',
selector: 'sourceslist'
}],
stores: ['Sources'],
init: function() {
// Start listening for events on views
this.control({
'sourceslist': {
selectionchange: this.onSourcesSelect
},
});
},
onLaunch: function() {
var sourcesStore = this.getSourcesStore();
sourcesStore.load({
callback: this.onSourcesLoad,
scope: this
});
},
onSourcesLoad: function() {
var sourcesList = this.getSourcesList();
sourcesList.getSelectionModel().select(0);
},
onSourcesSelect: function(selModel, selection) {
// Fire an application wide event
this.application.fireEvent('sourcesstart', selection[0]);
}
});