Results 1 to 3 of 3

Thread: Store sync doesn't trigger request

  1. #1
    Sencha User
    Join Date
    Dec 2013
    Posts
    41

    Default Store sync doesn't trigger request

    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.
    Code:
    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         }     }); };

  2. #2
    Sencha User existdissolve's Avatar
    Join Date
    Jan 2010
    Location
    Kansas
    Posts
    522
    Answers
    32

    Default

    Can you show the configuration of your store?
    Before pasting your code, see if you can make a working example using Sencha Fiddle: https://fiddle.sencha.com/

    Not only will it let everyone see what you're talking about with their own eyes, but it also makes debugging your issue 19 billion times easier

    Embedding your newly created Fiddle is super-easy: Using Sencha Fiddle in the Forums

  3. #3
    Sencha User
    Join Date
    Jul 2014
    Posts
    1

    Default

    my store config
    Code:
    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
    Code:
    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
            });

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •