PDA

View Full Version : Store sync doesn't trigger request



mirkotus
12 May 2014, 2:57 AM
For some reason my store.sync() command sometimes doesn't trigger no server requests. I am not sure why this is happening. The records are always modified when calling sync(). I have also tried debugging and the sync command in simply omitted(skipped) without any errors. Also the failure callback on store.sync is never called. I have also tried debugging on the beforesync event But the event handler is never called even if snync is triggered. I am out of ideas on how to debug this issue. Could you please assist.
console.debug(record.dirty); //TRUE console.debug(record.isValid()); //TRUE store.sync({ scope:this, callback : function(batch, options) { console.debug("ok"); //never reached }, failure : function(batch, options) { console.debug("failed"); //never reached } }); };

existdissolve
12 May 2014, 6:32 PM
Can you show the configuration of your store?

ksner
16 Jul 2014, 11:08 PM
my store config


Ext.define('Console.store.SubjectMaterial.DetailStore', {
extend: 'Ext.data.Store',


model: 'Console.model.SubjectMaterial.DetailModel',


proxy: {
actionMethods: 'POST',
type: 'ajax',


api: {
create : './modules/source/controller/SubjectMaterial/insertDetail.php',
read : './modules/source/store/SubjectMaterial/selectDetail.php',
destroy : './modules/source/controller/SubjectMaterial/deleteDetail.php'
},


reader: {
type: 'json',
root: 'result'
},


writer: {
type: 'json',
root: 'data',
encode: true
}
},


sorters: {
direction: 'ASC',
property: 'material_name'
},


remoteSort: true,
autoLoad: false,
autoSync: true
});

and my controll


var masterSelectedRecord = Ext.getCmp('sumagridmaster').getSelectionModel().getSelection()[0];
var detailStore = Ext.getCmp('sumagriddetail').store;
var actionPanel = obj.up('sumaactionpanel');
var gridPanel = obj.up('sumaformdetailinsert');
//gonligod
var record = gridPanel.getSelectionModel().getSelection()[0];
detailStore.add(record);
detailStore.sync({
success: function(batch, options) {
console.log('this is success.');
Ext.MessageBox.show({
title: MSG['universal_msg_box_header_text'],
icon: Ext.MessageBox.INFO,
msg: MSG['universal_msg_box_content_insert_success'],
closable: false,
buttons: Ext.MessageBox.OK,
fn: function(buttonId,text,opt){
if (buttonId == 'ok') {
detailStore.reload();
}
}
});
},


failure: function(batch, options) {
console.log('this is failure.');
Ext.MessageBox.show({
titel: MSG['universal_msg_box_header_text'],
icon: Ext.MessageBox.ERROR,
msg: MSG['universal_msg_box_content_insert_fail'],
closable: false,
buttons: Ext.MessageBox.OK
});
},


callback: function() {
console.log('finish sync.');
},
// scope: this
});