1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    1
    Vote Rating
    0
    Nameless11 is on a distinguished road

      0  

    Question Ext.ux.grid.FiltersFeature: getFilter() is undefined

    Ext.ux.grid.FiltersFeature: getFilter() is undefined


    Dear Community,

    I'm new to ExtJS and I'm facing some problems with Ext.ux.grid.FiltersFeature.
    I have a grid with Filter feature:

    Code:
    Ext.define('AM.view.book.ListOzon' ,{
        extend: 'Ext.grid.Panel',
        alias : 'widget.booklistozon',
        title : 'Books grid',
        store: 'BooksOzon',
        features: [{
            ftype: 'filters',
            encode: true,
            local: true,
            autoReload: false,
            filters: [{
                type: 'numeric',
                dataIndex: 'id'
            },{
                type: 'string',
                dataIndex: 'author'
            },{
                type: 'string',
                dataIndex: 'name'
            }]
        }],
        columns: [{
            header: 'Id',
            dataIndex: 'id',
            width: 70
        },{
            header: 'Author',
            dataIndex: 'author',
            flex: 2
        },{
            header: 'Book Title',
            dataIndex: 'name',
            flex: 3
        }]
    });
    I need to activate filter with some value by a button from outside a grid.
    I'm using the following code for a button click handler:

    Code:
    var bookListOzon = this.getBookListOzon();
    bookListOzon.filters.clearFilters();
    var filterId = bookListOzon.filters.getFilter('author');
    filterId.setValue('author_2');
    filterId.setActive(true);
    bookListOzon.filters.reload();
    It works well after filter is activated manually for 'author' column (e.g. ='author_1').
    But if I try to click a button when filter is not set manually before, I got an error since bookListOzon.filters.getFilter('author') is undefined.

    It seems to me this behavior is not correct. How can I set a value for a filter if it wasn't filled with some value before?

  2. #2
    Sencha User
    Join Date
    Nov 2010
    Posts
    3
    Vote Rating
    1
    carmeloferrante is on a distinguished road

      1  

    Default


    It tooks me a long time too, this night.
    In the end I found that this code should work:
    (change mygrid with the name of your grid)
    Code:
    mygrid.filters.addFilter({dataIndex: 'author', type: 'string', value: 'author_2'});
    mygrid.store.load();
    If you prefer you can even use
    Code:
    mygrid.filters.reload();
    insetad of
    Code:
    mygrid.store.load();
    To preserve the local or remote filtering settings
    Make us know if it worked for you too!

    Have a nice day!

  3. #3
    Sencha Premium Member
    Join Date
    May 2011
    Posts
    31
    Vote Rating
    1
    freshyseth is on a distinguished road

      0  

    Default Works for me!

    Works for me!


    I was able to get this working via a button. I'm about to tie it in with some checkbox functionality which brings up an issue I've been having. Right now whenever I addFilter to a grid's store the filters are applied using an AND condition. How do I apply filters using the OR condition?

    For instance, using the FiltersFeatures.js bound to columns in a datagrid I can select two options from a list in a single column and the filters does Option1 OR Option2. It even does ORs for other columns as well.

    So, how do I do that by programatically adding the filters?

    Thanks!

Similar Threads

  1. Replies: 14
    Last Post: 8 Dec 2011, 11:17 AM
  2. Replies: 3
    Last Post: 26 Apr 2011, 11:06 AM
  3. Grid, C is Undefined
    By panosru in forum Ext 2.x: Help & Discussion
    Replies: 14
    Last Post: 8 Jun 2010, 1:50 AM
  4. extended Grid gives this.ds is undefined
    By jsemmanuel in forum Ext 3.x: Help & Discussion
    Replies: 6
    Last Post: 22 Dec 2009, 8:19 AM
  5. [3.0] this.grid is undefined
    By FkrZiM in forum Ext 3.x: Help & Discussion
    Replies: 11
    Last Post: 26 Aug 2009, 7:07 AM

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi