Results 1 to 4 of 4

Thread: Store Sync Bug when using Filter

    You found a bug! We've classified it as EXTJS-5647 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member
    Join Date
    Dec 2011
    Posts
    2
    Vote Rating
    0
      0  

    Default Store Sync Bug when using Filter

    Ext 4.0.7, all browsers

    In Store (AbstractStore) I am calling the sync function to tell the store to persist changed data (I am storing data locally). Generally, this works fine, but there are fringe cases.

    If I have a filter on the store and I programmatically update a record which is fitlered out, then that record is never updated. The reason being that the sync method calls getUpdatedRecords;



    getUpdatedRecords: function() {
    return this.data.filterBy(this.filterUpdated).items;
    },


    The problem is that getUpdatedRecords uses this.data instead of this.snapshot. This seems like a bug since there are few, if any cases, where you want your filter applied to your communication with the proxy.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,358
    Vote Rating
    1501
      0  

    Default

    I would agree with you that it should check to see if this.snapshot exists and use it if it does, if not then use this.data.

    I will transfer this thread to the bugs forum to enter into our tracking system.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User Daniil's Avatar
    Join Date
    Jun 2010
    Location
    Saint-Petersburg, Russia
    Posts
    1,018
    Vote Rating
    125
      0  

    Default

    Hi everybody,

    It looks to be by design according to this note
    When store is filtered, most of the methods for accessing store data will be working only within the set of filtered records. Two notable exceptions are queryBy and getById.
    here
    http://docs.sencha.com/extjs/4.2.1/#...-method-filter

    Actually, the sync method works with a set of filtered method.

    Well, this decision is quite controversial. I mean syncing filtered records only. A user searches in the grid for some record using filters, edit a found record, search for another one, edit it, ..., and press a Save button. For sure he expects all the records to be saved. Probably, saving filtering records only could make sense. Though I could not imagine any scenario. However, I don't state there is no one.

    I think making a global option for a Store could be a solution. Like "syncFilteredOnly" (dislike the name, there should be better one) which is supposed to be false by default.

    @mitchellsimoens, is there any update on this issue? What do the designers of the Data package think about it?
    Object.NET
    Frameworks and Tools for .NET Developers
    --------------------------------------------------
    Ext.NET - Ext JS for ASP.NET - Examples | Twitter
    Bridge.NET - Write C#. Run JavaScript! - Live | Twitter
    --------------------------------------------------

  4. #4
    Sencha Premium Member
    Join Date
    Sep 2011
    Posts
    78
    Vote Rating
    2
      0  

    Default

    It seems this was "fixed" in 4.2.2 `EXTJSIV-5647 Filtered out records are missing from new and modified collection to sync.`
    which addresses the behaviour of *not* wanting the filter to apply to the sync.


    But we have code that relied on using the filter to only sync the selected items - how are we meant to do that now?

Posting Permissions

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