aBhijit
aBhijit

Reputation: 5391

Begin search on first keypress in jQuery Chosen

I am using jQuery chosen as an alternative to normal html 'select'. I went through its documentation and also its source files but couldn't achieve what I wanted.

My database is very large(50K entries). I populate the select tab with this data. When I click on this select it takes ages to drop down.

Here is the demo of my project.

Can I achieve the following in chosen.

-When I click select tag It should not show all the data initially.

-When I enter at least one charachter, results should get displayed.

If its not possible, is there an alternative to chosen which would solve the issue? Thanks.

Upvotes: 0

Views: 310

Answers (2)

Maverick
Maverick

Reputation: 478

Try using the Combobox version of jQuery Autocomplete: http://jqueryui.com/autocomplete/#combobox

It will help you make your control work like dropdown and autocomplete as well.

Hope it helps !!!

Upvotes: 1

alex
alex

Reputation: 547

this might be what you need: http://www.w3schools.com/tags/tag_datalist.asp

(or pretty close at least)

try this:

<input list="browsers">

<datalist id="browsers">
<?php
$con=mysqli_connect("example.com","peter","abc123","my_db");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con,"SELECT * FROM Persons");

while($row = mysqli_fetch_array($result))
  {
  echo  "<option value='".$row['FirstName'] . "' /> "
  echo "<br>";
  }

mysqli_close($con);
?> 

Upvotes: 1

Related Questions