Andreas5746429
Posts: 0
Joined: Thu Apr 11, 2013 4:11 pm

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

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

HI, working on it. I'll update.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

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

Andreas5746429
Posts: 0
Joined: Thu Apr 11, 2013 4:11 pm

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

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).

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

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...

Joe6207668
Posts: 0
Joined: Wed Sep 04, 2013 6:24 pm

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

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?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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.

Joe6207668
Posts: 0
Joined: Wed Sep 04, 2013 6:24 pm

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

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

Joe6207668
Posts: 0
Joined: Wed Sep 04, 2013 6:24 pm

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

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

Return to “Issues”