Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
qTip for auto complete using onkeyup problem
7th December, 16:51
Post: #1
qTip for auto complete using onkeyup problem
I have a text field.

I use the jquery keyup function and when text is entered I do an AJAX call to a script to get some results.

I then create a qtip instance on the text input field to show the results.

The issue is, a new qtip instance is getting created EVERY time the keyup function runs.

Is there a way to...
1. Check if a qtip exists on the text input ID/element and if so, update the contents and show
2. Destroy any existing qTips before the new one is displayed?

I tried using the $("#myID").qtip("destroy"); function in the onHide event but I get:
f(this).data("qtip") is undefined
Find all posts by this user
Quote this message in a reply
7th December, 17:31
Post: #2
qTip for auto complete using onkeyup problem
atDev, try using the onRender callback to set up a keyup event instead, and change the tooltips contents:

JS Code
$('.selector').qtip({
   content: 'test',
   api: {
      onRender: function()
      {
         var self = this;
 
         $('input').keyup(function()
         { 
             // Do some ajax call here and use the callback to change the tooltip content
             $.get('url', data, function(data)
             {
                self.updateContent(data.value);
             });
         });
      }
   }
});


Hope this is clear to you. Let us know how you get on!

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
7th December, 17:34
Post: #3
qTip for auto complete using onkeyup problem
Thanks this will probably work as well.

I entered up using the jQuery "one" function to initialize the qTip on focus of the text input field. Then just used the "keyup" event to update the content and run the "show" event on the qTip.
Find all posts by this user
Quote this message in a reply
7th December, 17:40
Post: #4
qTip for auto complete using onkeyup problem
I have another similar issue.

I don't want to initialize a qTip until the mousover event of a link.

So I have:

<a id="something" href="" onmouseover="$('#something').qtip({ ... });">?</a>

But again it is creating duplicate instances. Is there a better way to do this? Again, I don't really want to initialize the qTip unless I have to from the onmouseover event.
Find all posts by this user
Quote this message in a reply
7th December, 17:44
Post: #5
qTip for auto complete using onkeyup problem
atDev, you could again use the .one() method you used above to apply the mouseover? You'll be glad to know in the 1.0 version it has 'hoverIntent' built in, so mousing over the link accidentally won't trigger the tooltip rendering as it unfortunately does at the moment.

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
7th December, 18:13
Post: #6
qTip for auto complete using onkeyup problem
craig Wrote:atDev, you could again use the .one() method you used above to apply the mouseover? You'll be glad to know in the 1.0 version it has 'hoverIntent' built in, so mousing over the link accidentally won't trigger the tooltip rendering as it unfortunately does at the moment.

Well the different here is I already have the code under the "a" "onmouseover" event. So to use "one" to create the tooltip would require a different JS snippet outside of the onmouseover event. I was trying to eliminate having extra javascript outside of this for these tooltips since I have about 20-30 tooltips on each page.

It would perhaps be cool to have an option like...

$('#something').qtip({ duplicates: false });

Which would prevent duplicate qTips on the element. (i.e. destroy any before generating a new one).

Or possibly...

$('#something').qtip({ update: true });

Which would update an already existing qTip instead of generating a new one, if a qTip already exists on that element ID.
Find all posts by this user
Quote this message in a reply
8th December, 23:58
Post: #7
qTip for auto complete using onkeyup problem
atDev, I've given this some thought and think this is actually the way qTip should work by default. Since the primary purpose of the script is basic tooltip replacement, the newest branch, by default will only allow one tooltip attached to any element at one time. You can however adjust this on a per-element basis using the new exclusive option:

JS Code
$('.selector').qtip({
   exclusive: false // Alow more tooltips to be attached
});

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
9th December, 00:01
Post: #8
qTip for auto complete using onkeyup problem
Great, look forward to the new version.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Hiding tooltip problem sohailanwarpk 2 400 31st January 12:13
Last Post: sohailanwarpk
  qTip & ASP.NET UpdatePanel Postback Problem qTipNoob 4 3,028 10th January 15:01
Last Post: naupadnara
  [Solved] Starter problem enne87 1 627 12th July 17:29
Last Post: Craig
  Nested qtip opacity problem zensurfer 1 917 3rd May 12:49
Last Post: Craig
  qTip problem inside update panel tonofweb 2 1,114 12th April 08:26
Last Post: kiddailey
  [Solved] z-index problem RickardL 3 1,382 31st March 19:48
Last Post: kiddailey
  Simpel problem with qtip SnowJim 4 1,042 22nd February 20:08
Last Post: SnowJim
  Viewport problem dynamicmindset 8 1,413 18th February 02:12
Last Post: Craig
  [Solved] Problem with form and postdata in qtip Baukereg 2 2,687 25th January 18:02
Last Post: b0gui
  [Solved] Newbie problem :( todsa 4 1,070 24th December 01:03
Last Post: todsa



User(s) browsing this thread: 1 Guest(s)