Page 1 of 3

How to use search control without a button, as user types ...

Posted: Thu Apr 11, 2013 4:11 pm
by Andreas5746429

All Twitter and contacts search examples use a text input control and a button to search the feed. However, contacts can be searched (as they are natively on iPhone) as the user types.
I tried using the search control, assuming that it has a way to map output to a list and assuming that it responds to textchanged event, but neither is true.
I can't find anywhere the definition of the component.

That being said - I can build a custom component containing the input text box and a 3-line list below it, map the service call response to it and make it work.
The question is when? What event can I trap to make this happen? Is it any of the key pressed? Would they be consistent between Android and ios platforms?

I appreciate your insight.

Andreas


How to use search control without a button, as user types ...

Posted: Thu Apr 11, 2013 5:33 pm
by Maryna Brodina

HI, working on it. I'll update.


How to use search control without a button, as user types ...

Posted: Thu Apr 11, 2013 6:00 pm
by Maryna Brodina

You can use "Input" event which dispatched when user changes text in Input field.


How to use search control without a button, as user types ...

Posted: Thu Apr 11, 2013 6:59 pm
by Andreas5746429

I found out that works indeed. The control isn't working as expected but I am debugging the code now... I suspect I am not mapping the service call correctly.

I do wonder what the difference is between the Search component and the plain Text Input box. I expected the search component to come with a list where results can be mapped, but it appears to be exactly the same as the input box with one difference - the icon in the left of the box.

I appreciate your time. By the way - the site is simply amazing. I built my app in 4 days without knowing javascript at all (though I am versed in other languages).


How to use search control without a button, as user types ...

Posted: Thu Apr 11, 2013 7:43 pm
by Maryna Brodina

When you start entering text in Search Input "x" icon appears to clear the field, also this component has "Search" event which can be invoked when you click on icon in the left of the box. Search input you can use only for text as this component doesn't have any other types. Here is more information http://jquerymobile.com/demos/1.2.0/d...


How to use search control without a button, as user types ...

Posted: Mon Nov 18, 2013 8:02 pm
by Joe6207668

What if we already have a query service filling the grid? Is there a way to search the content already displayed on the page and refill the grid as the user types?


How to use search control without a button, as user types ...

Posted: Mon Nov 18, 2013 8:41 pm
by Kateryna Grynko

Hi Joe,

If you create a service that allows you to search data you can use but not search loaded data. This is not that ease.


How to use search control without a button, as user types ...

Posted: Mon Nov 18, 2013 9:23 pm
by Joe6207668

Could I map the response of the search to the same grid? Or would I need to create a new grid and hide it?


How to use search control without a button, as user types ...

Posted: Mon Nov 18, 2013 9:59 pm
by Kateryna Grynko

Sure, you can.


How to use search control without a button, as user types ...

Posted: Wed Nov 20, 2013 4:01 pm
by Joe6207668

Hey Katya!

Thanks it worked!

Now I would like to search more than one column. How should I edit the below js code to search four columns?

return '{"column1_name":{"$regex":"^'+value+'", "$options":"i"}}';

Thanks again for all your help!
Joe