Hi,

I can upload the client part but I am generating my JSON using ASP.NET
MVC and the project is not finish so I can't upload it because it uses
a SQL server.

Don't you have any idea what is going on?

I set up a page with this and I will try to explain what I get. When I
use:

      $("#Tags").autocomplete("/Professor/GetTags", {
        autoFill: true,
        selectFirst: false
            });

My autocomplete shows but only one option in the list ... however that
option is including all the options returned by the Json according to
that criteria.
For example, if I type "M" I get one option which when selected puts
the following in the input:

[{"TagID":"3fae2160-55f6-4dd0-b856-
fd27f5d307e2","Name":"Matemática","FileTags":[],"ProfessorTags":[]},
{"TagID":"883b197e-0cb3-4528-8403-0877d742bf47","Name":"Matemática
B","FileTags":[],"ProfessorTags":[]}]

You see? It picks the two options.

I tried again and typed "F" and I get:
[{"TagID":"017b253e-596b-4328-85f5-
fd97a783759c","Name":"Física","FileTags":[],"ProfessorTags":[]}]

Which is also right because I have only that record.
So the server code is receiving well the parameter and returning the
filtered records it but somehow the autocomplete interprets that as
only one record and does not display it the right way ...

I am using JSonResult of ASP.NET MVC to return the JSON and it seems
to be ok.

Any idea?

Thanks,
Miguel


On Jul 12, 5:23 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
wrote:
> Please upload a testpage and provide a link. There are too many things
> that can go wrong here.
>
> Jörn
>
> On Sat, Jul 12, 2008 at 3:32 PM, shapper <[EMAIL PROTECTED]> wrote:
>
> > 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