Advertise with us

Implement searchfield functionality in sencha touch

Posted by  Takeshi Okada
 2743  View(s)
Rate this:
Hi Expert!

I am getting problem that how to implement search field on tree store getting data from the server in sencha touch. Any working code will be appreciated.

Thanks in advance! 
  1. Re: Implement searchfield functionality in sencha touch

    Hi Takeshi!

    Assuming the data is already in the store when you search this isn't too difficult to implement using the methods referenced by speznaz.

    In your view have a xtype "searchfield" or "textfield".

        xtype: "searchfield",

    In the controller bind a "keyup" event to this field.

    refs: {
       searchfield: 'mypanel searchfield'
    control: {
       searchfield: {
          keyup: 'doSearch'

    For your function to search something like:

    doSearch: function(searchfield, e, eOpts) {
         var searchterm = searchfield.getValue();
         var store = Ext.getStore('myStore');

         // Now just customise the search options
         store.find(fieldName, value, [startIndex], [anyMatch], [caseSensitive], [exactMatch] );

    This is assuming you want to search on keyup. You may want to use the "action" event instead.

    I hope it helpful for you.

      Modified On Jun-01-2013 12:44:47 AM