Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typeahead does not hide when using with queryBy: ['name', 'username'], #13

Open
k-tejas opened this issue Jun 25, 2013 · 4 comments
Open

Comments

@k-tejas
Copy link

k-tejas commented Jun 25, 2013

I have following code :

var following_list;

 $.ajax({

        type :"POST",
        url:"http://linkzone.dev/ajax/follower/select",
        data: '',
        dataType : 'json',
        cache: false,
        async:false,
        success:function(result){ 
            following_list = result;
        },
        error: function(xhr, textStatus, errorThrown) { 

        } 
    });


$("#usermention").mention({
        delimiter: '@',
        queryBy: ['name', 'username'],
        users: following_list
});

AJAX request return following data :

[
{
"name":"Reagan Dietrich",
"username":"Reagan8"
},
{
"name":"Ashlynn Powlowski",
"username":"Ashlynn4"
},
{
"name":"Tejas Kulkarni",
"username":"tejas"
}
]

Now when I use trigger like @tejas and after that even though I put a space bar/enter key still it shows up the typeahead , also it deletes any further text .
issue

When i use it with queryBy: ['username'] It works fine .

@jakiestfu
Copy link
Owner

Are you using the CSS that came with the library?

Does changing your code to the following help?:

 $.ajax({

     type: "POST",
     url: "http://linkzone.dev/ajax/follower/select",
     data: '',
     dataType: 'json',
     cache: false,
     async: false,
     success: function (result) {
         $("#usermention").mention({
             delimiter: '@',
             queryBy: ['name', 'username'],
             users: result
         });
     },
     error: function (xhr, textStatus, errorThrown) {

     }
 });

@k-tejas
Copy link
Author

k-tejas commented Jun 25, 2013

Nope , Still same. Yeah i am using recommended-styles ,

Also this happens only with "@tejas" of the json response.
I tried following ( simplest same as given in docs ).
I just found out that it works only if username is alpha numeric .
now username is '@tejas2' it works , but for '@tejas' it keep showing typeahead :(

$("#usermention").mention({
delimiter: '@',
queryBy: ['name', 'username'],
users: [
{
"name":"Reagan Dietrich",
"username":"Reagan8"
},
{
"name":"Ashlynn Powlowski",
"username":"Ashlynn4"
},
{
"name":"Tejas Kulkarni",
"username":"tejas2"
},
{
"name":"Chaz McKenzie",
"username":"Chaz1"
}
]
});

@bijanebrahimi
Copy link

@k-tejas @jakiestfu fixed the bug. you can use my Mention.js Fork till my pull-request approves

@k-tejas
Copy link
Author

k-tejas commented Aug 15, 2013

thanks @bijanebrahimi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants