Hi,

I tried to make this work following your example but until now I
wasn't able to make this work?

Could you, please, help me out?

This is what I have at the moment:

      $("#Tags").autocomplete("/File/GetTags", {
        autoFill: true,
        cacheLength: 1,
        multiple: true,
        scrollHeight: 200,
        selectFirst: false,
        width: 260,
        parse: function(data) {
            return $.map(eval(data), function(row) {
              return {
                data: row,
                value: row.Name,
                result: row.Name
            }
          });
         },
        formatItem: function(item) {
           return item;
        }
   });

My JSon data is as follows:

[{"TagID":"883b197e-0cb3-4528-8403-0877d742bf47","Name":"John"},
{"TagID":"017b253e-596b-4328-85f5-fd97a783759c","Name":"Jane"}]

What am I doing wrong? I have been trying many variations of my code
but it still does not work.

Thanks,
Miguel

On Jul 12, 12:05 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
wrote:
> Remote json is still rather cumbersome to handle. Here is an example,
> take a look at the 
> source:http://dev.jquery.com/view/trunk/plugins/autocomplete/demo/json.html
>
> Jörn
>
> On Sat, Jul 12, 2008 at 1:01 AM, shapper <[EMAIL PROTECTED]> wrote:
>
> > I also tried the following but until now I wasn't able to make it
> > work:
>
> >      $("#Tags").autocomplete("/Professor/GetTags", {
> >        autoFill: true,
> >        cacheLength: 1,
> >        multiple: true,
> >        scrollHeight: 200,
> >        selectFirst: false,
> >                    width: 260,
> >                    formatResult: function(item) {
> >          return item.Name;
> >        }
> >     });
>
> > Please, does anyone knows how to do this?
>
> > MyJson data is as follows:
> > [{"TagID":"3fae2160-55f6-4dd0-b856-fd27f5d307e2","Name":"John"},
> > {"TagID":"883b197e-0cb3-4528-8403-0877d742bf47","Name":"Jane"}]
>
> > I have been trying to solve this but until now I wasn't able ...
>
> > Thanks,
> > Miguel
>
> > On Jul 11, 8:53 pm, shapper <[EMAIL PROTECTED]> wrote:
> >> Yes,
>
> >> I tried the following:
>
> >>       $("#Tags").autocomplete("/File/GetTags", {
> >>         width: 260,
> >>         formatItem: function(item) {
> >>           return item.Name;
> >>         }
> >>       });
>
> >> But this is not working. Any idea?
>
> >> Thanks,
> >> Miguel
>
> >> On Jul 11, 7:03 pm, tlphipps <[EMAIL PROTECTED]> wrote:
>
> >> > You need to use the formatResult option (I think that's the option
> >> > name).  It will allow you to format the data for display.
>
> >> > On Jul 11, 12:08 pm, shapper <[EMAIL PROTECTED]> wrote:
>
> >> > > Hello,
>
> >> > > I am using JQuery AutoComplete with JSon. I created a function on my
> >> > > server code which return the data.
>
> >> > > However, when I start writing "J" in my Input I get the following:
>
> >> > > [{"TagID":"883b197e-0cb3-4528-8403-0877d742bf47","Name":"John"},
> >> > > {"TagID":"017b253e-596b-4328-85f5-fd97a783759c","Name":"Jane"}]
>
> >> > > How to get only the names instead of this strange format? Am I a
> >> > > missing something here?
>
> >> > > Thanks,
> >> > > Miguel

Reply via email to