Results 1 to 2 of 2

Thread: How to sync store without adding a record to store

  1. #1
    Sencha User
    Join Date
    Apr 2014
    Posts
    19
    Answers
    2

    Default How to sync store without adding a record to store

    Hi,

    I have a store with records. All CRUD operations are done through service calls. If suppose there is a table with columns Id and Name. There is a unique key constraint for 'Name' column. I will try to create a record which already exist in the database.
    Code:
    store.add(record);
    store.sync(            {
                    success: function()
                    {
                        Ext.Msg.alert('Status', 'Successfully saved');
                    },
                    failure: function()
                    {
                        Ext.Msg.alert('Attention', 'Failed to save');
                    },
                    callback: function()
                    {
                        store.load();
                    },
                    scope: this
                })
    As the new record is a duplicate record, database will throw exception, i ll get below message and store will be loaded.
    Code:
    Ext.Msg.alert('Attention', 'Failed to save');
    If suppose the service call & response is slow, store.add(record) will add record to store and i can see the duplicate record in grid. Due to slow response from service, store.sync() will not repond immediately. Database throws exception exception saying duplicate entry and 'Failed to save' message will be shown and store ll be reloded.

    My question is how can I avoid record being added to grid till i get response from store.sync().

    Please help me.

    Thanks & regards
    Rakesh

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    How slow is the response time from the server on average?

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
  •