Author Topic: Tooltipster  (Read 630 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Tooltipster
« on: January 16, 2023, 07:43:28 pm »
Trying to set HTML content for tooltipster to button in toolbar in refresh event, but can't get it to work properly. Using title attribute on element works fine though...

toolbar with title attribute works:
Code: [Select]
type: 'button',
label: "toolbar_element",
attr: 'title="test"',
cls: 'tooltip'

toolbar with id and set content in refresh event (do not work):
Code: [Select]
type: 'button',
label: "toolbar_element",
attr: 'id="toolbar_element"',
cls: 'tooltip'

refresh event
Code: [Select]
$('.tooltip:not(".tooltipstered")#toolbar_element').tooltipster({
content: $('<span><strong>This text is in bold case !</strong></span>')
});

Old thread:
https://paramquery.com/forum/index.php?topic=1979
« Last Edit: January 16, 2023, 08:57:48 pm by queensgambit9 »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Tooltipster
« Reply #1 on: January 16, 2023, 11:22:26 pm »
Solved.

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Tooltipster
« Reply #2 on: January 19, 2023, 12:34:51 pm »
Still having issue with this...

in toolbar:
Code: [Select]
{
  type: 'button',
  label: "label",
  attr: 'id="toolbar_button"'
}

in reftresh event:
Code: [Select]
refresh: function() {
                   
  $('#toolbar_button').tooltipster({               
    content: $('<strong>this is a text</strong>')
  });

}

It works but in console I get output:

Code: [Select]
Tooltipster: one or more tooltips are already attached to the element below. Ignoring.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Tooltipster
« Reply #3 on: January 19, 2023, 12:50:45 pm »
Please use toolbar.item init callback to initialize the custom control in toolbar.

https://paramquery.com/pro/api#option-toolbar


queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Tooltipster
« Reply #4 on: January 19, 2023, 02:54:41 pm »
ok, tried this in toolbar item:

Code: [Select]
init: function() {

$('#toolbar_button').tooltipster({               
    content: $('<strong>this is a text</strong>')
  });

}

but this generates even more of the console messages...I guess the callback is not correct?
« Last Edit: January 19, 2023, 03:06:59 pm by queensgambit9 »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Tooltipster
« Reply #5 on: January 19, 2023, 03:25:32 pm »
Add a check:

Code: [Select]
if( !$( '#toolbar_button' ).hasClass("tooltipstered") ){
  $('#toolbar_button').tooltipster({               
    content: $('<strong>this is a text</strong>')
  });
}

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Tooltipster
« Reply #6 on: January 19, 2023, 03:33:51 pm »
Works fine, thanks.

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Tooltipster
« Reply #7 on: January 19, 2023, 04:07:41 pm »
Hmm...Im using jQuery tabs for multiple grids where I reuse the toolbar. Nothing happens when the tooltip is triggered on other tabs and no error message is given.
Is there any modifications needed when using jQuery tabs for the other tabs to work?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Tooltipster
« Reply #8 on: January 19, 2023, 04:13:26 pm »
You should assign class instead of id to the control because id is unique on a document and can't be shared between tabs.

and need one more correction:

Code: [Select]
init: function(ele) {

  $(ele).tooltipster({  //use ele to initialize.
    content: $('<strong>this is a text</strong>')
  });

}

you can add check to the above code if there are any console errors/warnings.

Example of custom controls in toolbar: https://paramquery.com/pro/demos/import_xlsx_tabs
« Last Edit: January 19, 2023, 05:13:11 pm by paramvir »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Tooltipster
« Reply #9 on: January 19, 2023, 06:21:25 pm »
Seems to work fine, so no class is needed with this method (ele) for tooltipster I guess?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Tooltipster
« Reply #10 on: January 19, 2023, 06:46:35 pm »
yeah right!