views:

102

answers:

1

Hello

i've an data array like this:

var data = [
{ nachname:"Mustermann", vorname:"Stefan", email:"[email protected]", strasse:"Musterstrasse", hausnummer:"1", plz:"12345", vorwahl:"0361", telefon:"12345"},
{ nachname:"Mustermann", vorname:"Robert", email:"[email protected]", strasse:"Musterstrasse", hausnummer:"1", plz:"12345", vorwahl:"0361", telefon:"54321"},
{ nachname:"Musterfrau", vorname:"Katja", email:"[email protected]", strasse:"Musterstrasse", hausnummer:"2", plz:"12345", vorwahl:"", telefon:""},
{ nachname:"Musterfrau", vorname:"Lisa", email:"[email protected]", strasse:"Amger", hausnummer:"3", plz:"99099", vorwahl:"", telefon:""}
];

and i'm using jQuery autocompleter

 $(document).ready(function(){
       $("#Personen").autocomplete(data, {
            minChars: 0,
            width: 310,
            matchContains: "word",
            autoFill: false,

            formatItem: function(row, i, max){                      
            return i + "/" + max + ": \""+ row.nachname + "\" " + row.email + "";
            },
            formatMatch: function(row, i, max){
                return row.vorname + " " + row.nachname + " " + row.email;
            },
            formatResult: function(row){
                return row.email;
            }
       })
});   

is it possible to get the categories for the autocompleter from the data array like:

vorname:

  • stefan
  • robert

or the same with strasse and so on?

not only the data directly?

regards stefan

A: 

ok ty, but i want to use categories in my suggestion list like

vorname

  • stefan
  • robert

street

  • Musterstrasse
  • ....

email

  • ...
Stefan