Results 1 to 3 of 3

Thread: How to clone store current values

  1. #1
    Sencha User
    Join Date
    Mar 2016
    Posts
    99
    Answers
    5

    Default How to clone store current values

    I have this code

    me.store.filter('missionId', i);
    var missionSteps = me.store.getData();
    me.store.clearFilter();

    I expected that after getData I will have unchanged cloned values. I have link to array instead of new array, so after filter is cleared I get more values than I need.

    Ext.clone and Ext.Array.clone didn't work. When I tried lodash _.clone - it worked fine. Is there a way to do that using only ExtJS?

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2012
    Posts
    4

    Default

    I'm exactly on the same.

    it will be a nice feature having some thing like this:
    -------------- CODE
    let clonedStore = someOtherStore.clone();
    (clonedStore.getAt(0).getId() !== (clonedStore.getAt(0).getId()) == true ? console.log('success') : console.log('failure');
    ------------- END CODE

  3. #3
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448
    Answers
    3997

    Default

    Have you checked out ChainedStore. You can give it a source store and can filter/sort it without affecting the source store.
    Mitchell Simoens @LikelyMitch

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

    Posts are my own, not any current, past or future employer's.

Similar Threads

  1. Replies: 3
    Last Post: 21 Nov 2017, 10:01 AM
  2. Replies: 3
    Last Post: 12 Jul 2017, 9:15 PM
  3. Ext.clone a store
    By Webtel in forum Ext: Q&A
    Replies: 4
    Last Post: 19 Mar 2012, 4:07 AM
  4. How to clone a store
    By tdikarim in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 16 Jan 2012, 7:03 AM

Posting Permissions

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