Hello,
I have a file that is loaded in the <head> containing:
var data= [
{ name: "Anabel", surname:"Smith", age: "19", email: "lala@lalala.lala", id: "Ana" },
.....................................
];
I am using the following code in order to search:
- <script type="text/javascript">
- $().ready(function() {
-
- $("#searchtext").autocomplete(data, {
- minChars: 3,
- mustMatch:false,
- scroll: false,
- max:15,
- width: 310,
- matchContains: "word",
- autoFill: false,
- formatItem: function(row, i, max) {
- return row.name + " - " + row.surname + " " + row.age + " (" + row.email + ") -" + row.id;
- },
-
- formatMatch: function(row, i, max) {
- return row.name
-
- },
-
- formatResult: function(row) {
- return row.id;
- }
- });
if someone search for the name, everything works ok,
but I want to be able to search by id and then by name then by email etc.
For example:
If someone enter Ana in the search field the first three letters of Anabel are returned.
I want first the list to be searched by id, then by name, and so on...
How can this be accomplished?
Can someone please help me?
/N