1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    19
    Vote Rating
    0
    johnseelewis is on a distinguished road

      0  

    Default Answered: Lost on Searching (using filters)

    Answered: Lost on Searching (using filters)


    Okay, I have given this some effort, but I am still stuck. Could someone help me figure out how to search? I have a panel with a search form and a list panel and I am trying to update the store that is linked to the list panel.

    Code:
    	
    onSearchAction : function() {	var val = App.views.searchField.getValue();
    	console.log('onSearchAction()  val = ' + val);
    	var filter = new Ext.util.Filter({
    		property : 'lookupTerm',
    		value : val
    	});
    	var filters = [ filter ];
    	App.stores.Lookup.clearFilter();
    	App.stores.Lookup.filter(filters);
    },
    Any filter I seem to add filters out everything in the list. Can anyone tell me why this is happening?

    Also, the Kiva and TouchStyle examples has these search events bubble to a controller that actually applies the filters. Is this just a pattern or is this something I should try. It seems like an over-complicated solution. Sure, my way isn't true MVC, but what is?

    Thoughts anyone?

  2. Hello,
    my uses of filter on a store have not explicitly constructed an Ext.util.Filter
    Have you attempted with a simple js object array like this?

    Code:
            onSearchAction : function() {            var val = App.views.searchField.getValue();
                console.log('onSearchAction()  val = ' + val);
                var filter = {
                    property : 'lookupTerm',
                    value : val
                };
                var filters = [ filter ];
                App.stores.Lookup.clearFilter();
                App.stores.Lookup.filter(filters);
            },

  3. #2
    Sencha Premium Member
    Join Date
    May 2008
    Location
    Pasadena, California
    Posts
    172
    Vote Rating
    2
    Answers
    27
    NickT is on a distinguished road

      0  

    Default


    Hello,
    my uses of filter on a store have not explicitly constructed an Ext.util.Filter
    Have you attempted with a simple js object array like this?

    Code:
            onSearchAction : function() {            var val = App.views.searchField.getValue();
                console.log('onSearchAction()  val = ' + val);
                var filter = {
                    property : 'lookupTerm',
                    value : val
                };
                var filters = [ filter ];
                App.stores.Lookup.clearFilter();
                App.stores.Lookup.filter(filters);
            },

  4. #3
    Sencha User
    Join Date
    Sep 2011
    Location
    Sallanches, France
    Posts
    371
    Vote Rating
    1
    Answers
    16
    myput is on a distinguished road

      0  

    Default


    I think for doing what you want, you must pass by a php script and filter the request and refresh your view with the new Json return... it's what i do but it's in an another panel i do my search.
    I'm not an expert, then i hope somebody say you if there is a better solution

  5. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    19
    Vote Rating
    0
    johnseelewis is on a distinguished road

      0  

    Default


    Thanks! That worked. Much appreciated. I think its strange it worked though...

Thread Participants: 2

Tags for this Thread