Results 1 to 6 of 6

Thread: get total count for filtered store?

  1. #1
    Sencha User jep's Avatar
    Join Date
    Sep 2010
    Posts
    862
    Answers
    1

    Default Answered: get total count for filtered store?

    Is there some way to get the total number of records on a filtered store? Previously, you could use store.snapshot.length (with certain caveats).

  2. Since the store data is not a simple Array but an Ext.util.Collection instance, you can get the total length of unfiltered data by the following line of code:

    Code:
    var total = store.getData().all.length;
    where "store" is your store instance.

    Hope this helps.

  3. #2
    Sencha User AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Location
    Italy
    Posts
    1,395
    Answers
    148

    Default

    Since the store data is not a simple Array but an Ext.util.Collection instance, you can get the total length of unfiltered data by the following line of code:

    Code:
    var total = store.getData().all.length;
    where "store" is your store instance.

    Hope this helps.
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    Owner at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    https://github.com/AndreaCammarata/TUX


  4. #3
    Sencha User
    Join Date
    Apr 2011
    Posts
    11

    Default

    http://docs.sencha.com/touch/2-0/#!/api/Ext.data.Store-method-getCount

    I
    f you gave an storeId in the config when you defined the store this should work: storeId.getCount();

  5. #4
    Sencha User jep's Avatar
    Join Date
    Sep 2010
    Posts
    862
    Answers
    1

    Default

    Thanks, Andrea. There should really be a function added to Store that does this. This is some very undocumented voodoo.

    Biller - No, that's just the regular count. When you filter a store, that count is the count of items after the filter is run. I was looking to get the count BEFORE the filter was run. Thanks for replying, though.

  6. #5
    Sencha User jep's Avatar
    Join Date
    Sep 2010
    Posts
    862
    Answers
    1

  7. #6
    Sencha User
    Join Date
    Jun 2019
    Posts
    1

    Default

    App.stoSeries.suspendEvents();
    App.grdSeries.getFilterPlugin().clearFilters();
    App.grdSeries.getFilterPlugin().getFilter('ID').setValue([id, ""]);
    App.grdSeries.getFilterPlugin().getFilter('ID').setActive(true);
    App.stoSeries.resumeEvents();


    when i know that job is complete ?

Posting Permissions

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