Initialize JQuery Plugins AFTER fnDraw()
Initialize JQuery Plugins AFTER fnDraw()
swg1cor14
Posts: 2Questions: 0Answers: 0
My server sends back the columns with one of these columns data having an icon that I have data-toggle="popover" and a title="some text". I use
[code]
"fnInitComplete": function() {
$('.attnIcon').tooltip();
$(".attnIcon[data-toggle=popover]")
.popover({ html: true, placement: 'right'});
}
[/code]
And it works. But I have a setInterval every 30 seconds to call a fnDraw() on the table with this command:
[code]
setInterval(function() {
oDataTable.fnDraw(false);
$('.attnIcon').tooltip();
$(".attnIcon[data-toggle=popover]")
.popover({ html: true, placement: 'right'});
} , 30000);
[/code]
oDataTable is my variable set for the table and it redraws the table correctly however the tooltop and popovers do not work. Its like:
[code]
$('.attnIcon').tooltip();
$(".attnIcon[data-toggle=popover]")
.popover({ html: true, placement: 'right'});
[/code]
Don't get called after the fnDraw(). So how can I reinitialize tooltop and popover after fnDraw().
Example: http://forexflowcopier.com/addUser.php
[code]
"fnInitComplete": function() {
$('.attnIcon').tooltip();
$(".attnIcon[data-toggle=popover]")
.popover({ html: true, placement: 'right'});
}
[/code]
And it works. But I have a setInterval every 30 seconds to call a fnDraw() on the table with this command:
[code]
setInterval(function() {
oDataTable.fnDraw(false);
$('.attnIcon').tooltip();
$(".attnIcon[data-toggle=popover]")
.popover({ html: true, placement: 'right'});
} , 30000);
[/code]
oDataTable is my variable set for the table and it redraws the table correctly however the tooltop and popovers do not work. Its like:
[code]
$('.attnIcon').tooltip();
$(".attnIcon[data-toggle=popover]")
.popover({ html: true, placement: 'right'});
[/code]
Don't get called after the fnDraw(). So how can I reinitialize tooltop and popover after fnDraw().
Example: http://forexflowcopier.com/addUser.php
This discussion has been closed.
Replies
Thanks for the link to the test page :-)
Allan
And wherever possible (not possible in your example!) I use delegated listeners. So for example, instead of binding a click even with each fnRowCallback, I make a generic listener that listens from the table level and therefore only need to bind once... then the clicks are able to get the needed information (most are in the href attribute) and act on it. ;)
Anyhow, not adding anything new here... just commiserating that it's tricky getting the timing set up for a polling application. Lots of juggling!