IMPLEMENT SEARCHFIELD FUNCTIONALITY IN SENCHA TOUCH

Takeshi Okada

Total Post:89

Points:629
Posted by  Takeshi Okada
 1984  View(s)
Ratings:
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. AVADHESH PATEL

    Post:604

    Points:4228
    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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!