1. #1
    Sencha User
    Join Date
    Oct 2007
    Posts
    155
    Vote Rating
    0
    thatcoder is on a distinguished road

      0  

    Default GridPanel, GroupingStore and store.filter

    GridPanel, GroupingStore and store.filter


    How do you go about applying multiple filters to a store?

    I've tried
    Code:
    store.filter('name', nameValue);
    store.filter('status', statusValue);
    If the name was the only item being filtered, things would be ok, but if it is a case where multiple filters were run on the store, only the last filter would be executed. Is there anyway to filter on the current snapShot of the store?

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Just use filterBy, e.g.

    Code:
    store.filterBy(function(record, id) {
      return (record.get('name') == nameValue) && (record.get('status') == statusValue);
    });

  3. #3
    Ext User
    Join Date
    Apr 2009
    Posts
    7
    Vote Rating
    0
    enko is on a distinguished road

      0  

    Default store filter problem

    store filter problem


    Hi all,
    I have very basic question.
    I can't make filters work.
    I am using a grid and i like the grid to display only rows with 'install' string in the column 'type'.
    I am using the data store in grid and this is the code for the data store:


    function loadDataStore(){
    var store = new Ext.data.Store({
    url: 'url.do',
    reader: new Ext.data.JsonReader({
    root:'rows',
    totalProperty: 'results',
    id:'id'
    }, [
    'id',
    {name: 'date', type: 'date', dateFormat: 'd/m/Y'},
    'event',
    'by',
    'type',
    'description',
    'status'
    ])
    });

    store.load();
    store.filter('type', 'Install');
    return store;
    }

    Can anybody help me.
    Thanks!

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    You forgot that loading is asynchronous.

    Calling load() sends a request to the server, but the records won't be loaded until the response is received from the server.

    Try:
    Code:
    store.load({
      callback: function(){
        store.filter('type', 'Install');
      }
    });

  5. #5
    Ext User
    Join Date
    Apr 2009
    Posts
    7
    Vote Rating
    0
    enko is on a distinguished road

      0  

    Default


    Great that's working fine.
    Thanks!

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    I don't understand. Can you rephrase the question?

  7. #7
    Ext User
    Join Date
    Sep 2009
    Posts
    27
    Vote Rating
    0
    Johny Joe is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    Just use filterBy, e.g.

    Code:
    store.filterBy(function(record, id) {
      return (record.get('name') == nameValue) && (record.get('status') == statusValue);
    });
    I combine tehnique in here:
    http://www.extjs.com/forum/showthread.php?t=66005 with code-snippet above...
    to filter based on the generated-field (ajax)

    But it doesn't work....

    only for previously loaded store then it works.

    Any clues?

  8. #8
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    I don't completely understand your problem...

    But for the original problem:
    Loading a store and then filtering it can be slow when a component (dataview, grid etc.) is attached, because all rows are rendered before they are filtered. That is why I requested persistent store filtering.

Thread Participants: 3

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar