Results 1 to 5 of 5

Thread: Using Ext.data.Store filter?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User Ingol's Avatar
    Join Date
    May 2011
    Location
    Moon
    Posts
    4
    Vote Rating
    3
      0  

    Question Using Ext.data.Store filter?

    Hi,

    I am pretty new to ExtJS but Im loving It ,

    How to take value from input field and then filter it through JSON, and then show results in a grid , not before filtering? IS it possible, on the client -side?

  2. #2
    Sencha User Ingol's Avatar
    Join Date
    May 2011
    Location
    Moon
    Posts
    4
    Vote Rating
    3
      1  

    Default

    This works, but only once, second time i click button, no result? Also, works only if autoLoad:true, but if this set to false, no result at all, pleeass hellp!


    xtype: 'button',
    text:'Searchi',
    width:80,
    handler:function(){

    store.filter('fieldName', Ext.getCmp("fieldId").getValue());

    }


    Which means that it doesnt search through JSON, but only cuts down what has been already shown... ?????

  3. #3
    Sencha User Ingol's Avatar
    Join Date
    May 2011
    Location
    Moon
    Posts
    4
    Vote Rating
    3
      1  

    Default

    Ok, so ,

    Code:
    handler:function(){
    	var me = Ext.getCmp("textFieldNaziv").getValue();
    	myStore.filter('naziv', me);
    }
    only filters data that has already been displayed to grid, but how to filter JSON, or STORE, so when i click second time it starts from top of the DATA(json), considering that autoLoad is false????

    Please guys, just a hint, link....

  4. #4
    Sencha User Ingol's Avatar
    Join Date
    May 2011
    Location
    Moon
    Posts
    4
    Vote Rating
    3
      1  

    Wink ANSWER

    The answer is:
    Code:
    {
        xtype: 'button',
        text:'Search',
        handler:function(){
    
            store.clearFilter();
            var searchValue = Ext.getCmp("textFieldId").getValue();
            store.load().filter('jsonGridFielName', searchValue);
    
        }                   
    
    }

  5. #5
    Sencha User
    Join Date
    Nov 2010
    Posts
    118
    Vote Rating
    9
      0  

    Default

    Quote Originally Posted by Ingol View Post
    The answer is:
    Code:
    {
        xtype: 'button',
        text:'Search',
        handler:function(){
            store.clearFilter();
            var searchValue = Ext.getCmp("textFieldId").getValue();
            store.load().filter('jsonGridFielName', searchValue);
        }
    }
    Just beware that store.clearFilter() can take significant time to complete when working with many records. If need be, there is a way to obviate the clearFilter call (but it's not trivial).

Tags for this Thread

Posting Permissions

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