1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    5
    Vote Rating
    0
    muliyono.lu is on a distinguished road

      0  

    Default How to delete the data in Store that's already filtered

    Help me Please

    How to delete the data in Store that's already filtered
    Code:
    SharpJs.TrPenaltiesStore.filter('DefectId', 'CR01', false, true);
    I got two record where DefectId = CR01 from this filter action
    Then I want to remove the records
    Code:
    SharpJs.TrPenaltiesStore.remove();
    After process that code, all of data except that DefectId = 'CR01' is removed
    I want to keep that data but it's removed from the store and the data that I want to remove is still keep in the store.
    How to handle this? Please help me Thanks

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,391
    Vote Rating
    1096
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    store.removeAll() should remove all data, filtered or not filtered.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jan 2013
    Posts
    5
    Vote Rating
    0
    muliyono.lu is on a distinguished road

      0  

    Default

    But I don't want to remove all data
    I just want to remove the data that's already filtered and want to keep the others record in the store.
    Still confuse with it
    Because when I read to the store when it's filtered I got the right record (all record that DefectId ='CR01')
    But when I process the .remove function the data that's remove not same with what I read
    The data that's remove from the store is all the data in the store except CR01.
    So after process remove I just got the filtered data. But it's different with what I want.
    Actually I want to remove the record that's already filtered and keep the others, but I got remove the others and keep the filtered record.

  4. #4
    Sencha User
    Join Date
    Jan 2011
    Posts
    549
    Vote Rating
    54
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default

    One way of returning the filtered records is by attaching a function to the filtering, as seen in the API documentation:
    http://docs.sencha.com/ext-js/3-4/#!...-method-filter

    Code:
    store.filter([  {
        property     : 'name',
        value        : 'Ed',
        anyMatch     : true, //optional, defaults to true
        caseSensitive: true  //optional, defaults to true
      },
    
    
      //filter functions can also be passed
      {
        fn   : function(record) {
          return record.get('age') == 24
        },
        scope: this
      }
    ]);
    In the function, you could simply pass all the returned records to an array, then remove these when required.

  5. #5
    Sencha User
    Join Date
    Jan 2013
    Posts
    5
    Vote Rating
    0
    muliyono.lu is on a distinguished road

      0  

    Default

    Thanks willigogs
    Your posting really helpful