Results 1 to 2 of 2

Thread: Problem configuring a store with proxy and sync

  1. #1
    Sencha Premium User
    Join Date
    Jul 2017
    Posts
    3

    Default Problem configuring a store with proxy and sync

    Hi,
    I am using Extjs 6.0.1.250 here.
    I have a store which load data from server correctly.

    I need this store to be able to send his new records to the server.

    But when i add new records, autosync does nothing. Same if i call sync() "manually". No request is sent in both case.

    I have been looking all around for a few hours now and i am still stuck.
    Do you see anything wrong with my store ?

    Store definition
    Code:
    Ext.define('Gnt.examples.advanced.store.Tags', {
        extend  : 'Ext.data.Store',
    alias   : 'store.tags',
    autoLoad        : false,
    storeId : 'tags',
    autoSync:true,
    model   : 'Gnt.examples.advanced.model.Tag',
    proxy: {
            type: 'ajax',
    url:'/projets/gantt/gettags',
    api: {
                read:'/projets/gantt/gettags',
    create:'/projets/gantt/settags'
    /*update:'/projets/gantt/gettags',
                 delete:'/projets/gantt/gettags'*/
    },
    reader: {
                type: 'json',
    rootProperty: 'data',
    successProperty: 'success'
    },
    writer : {
                type : 'json',
    rootProperty : 'data',
    allowSingle : false
    }
        }
    });
    
    the model associated
    Code:
    Ext.define('Gnt.examples.advanced.model.Tag', {
        extend: 'Ext.data.Model',
    alias   : 'model.tag',
    idProperty: 'NAME',
    fields : [
            {name:'NAME',type:'string'}
        ]
    });
    
    The way i test it is:

    1) Ext.data.StoreManager.lookup('tags'); It correctly return my store
    2) Ext.data.StoreManager.lookup('tags').insert(0,Ext.create('model.tag', {NAME: 'test'}));
    It correctly add "test" to my store but Sync is not triggered
    3) Ext.data.StoreManager.lookup('tags').sync(); Also does nothing

    Do you see anything wrong ?

    Thank you for your time and help.

  2. #2
    Sencha User yeghikyan's Avatar
    Join Date
    Mar 2009
    Location
    München
    Posts
    574
    Answers
    99

    Default

    Looks like to be extjs bug in 6.0 and even 6.5
    If you will disable/enable the idProperty in the model the autosync will work/do not work.

    "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague." – Edsger W. Dijkstra

Similar Threads

  1. Problem sync proxy store
    By PabloPerezAdsuar in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 26 Feb 2014, 6:10 AM
  2. Problem sync proxy store
    By PabloPerezAdsuar in forum Sencha Touch 2.x: Bugs
    Replies: 0
    Last Post: 24 Feb 2014, 4:56 AM
  3. Replies: 3
    Last Post: 15 Oct 2012, 11:35 PM

Tags for this Thread

Posting Permissions

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