I have a Web App that I manually ported from ExtJS 4 to ExtJS 7. For the most part, the read queries work.
However, upon further testing, the create and update queries are not working at all.
For example, there are various dialog boxes/floating panels where I can create and edit certain models using a form, and after the user presses the "Save" button. In ExtJS4, I could simply do the following:
For creating new models:
var model = Ext.create('AppName.model.Model_Name', {});
var store = Ext.getStore('Store_Name');
var form = button.up('form');
form.updateRecord(model);
store.add(model);
store.sync({
// code for callback
});
And for updating models, I do something like:
var form = button.up('form');
var model = form.getRecord();
var store = Ext.getStore('Store_Name');
form.updateRecord(model);
form.set('field_1', value_1);
form.set('field_2', value_2);
store.sync({
// code for callback
});
And then I would not have any troubles, the store/proxy would usually execute either the create or the update query as specified.
Here's an example of the store:
Ext.define('App.store.store_name', {
extend: 'Ext.data.Store',
requires: [
'App.model.model_name',
'Ext.data.proxy.Ajax',
'Ext.data.reader.Json',
'Ext.data.writer.Json'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
storeId: 'store_id',
batchUpdateMode: 'complete',
model: 'App.model.model_name',
proxy: {
type: 'ajax',
batchActions: false,
api: {
create: 'folder/folder/createQuery.php',
read: 'folder/folder/readQuery.php',
update: 'folder/folder/updateQuery.php',
destroy: 'folder/folder/deleteQuery.php'
},
url: '',
reader: {
type: 'json',
keepRawData: true,
messageProperty: 'message',
rootProperty: 'data'
},
writer: {
type: 'json',
writeAllFields: true,
encode: true,
rootProperty: 'data'
}
}
}, cfg)]);
}
});
However, it seems that in ExtJS 7, it doesn't work like this anymore. I placed echo lines in my create and update PHP code just to see if the PHP code gets executed. This usually helps me debug the PHP Code as well. However in this case, none of the echo statements show up.
Is there any parameter I need to implement in the store or proxy?