Datatables doesn't load after one click
Datatables doesn't load after one click
Hello,
I have a little problem right with jQuery and Datatables.
A link click call a send_target() function :
[code]
Load
[/code]
Then, I call a PHP page which shows a table and I set call the Datatables plugin :
[code]
function send_target() {
var str = $("#submit_form").serialize();
$.ajax({
url: 'tasks/test.php?form='+str,
cache : false,
success: function(data) {
$('#display_targets').html(data);
// dataTable init
if($("#dt_example").length > 0) $.rloader([
{ type: 'css', src: 'templates/default/modules/datatables/css/demo_table_jui.css' },
{ type: 'js', src: 'templates/default/modules/datatables/js/jquery.dataTables.js', callback: function(){
$('#dt_example').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers"
});
} }
]);
}
});
}
[/code]
At the first click, it works great, but after the first click, it's like the plugin is not loaded. I tried to include the datatables loader in the PHP page, outside the ajax function, and I still have the same problem. If I reload the page, it works only at the first click too.
[code]
// dataTable init
if($("#dt_example").length > 0) $.rloader([
{ type: 'css', src: 'templates/default/modules/datatables/css/demo_table_jui.css' },
{ type: 'js', src: 'templates/default/modules/datatables/js/jquery.dataTables.js', callback: function(){
$('#dt_example').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers"
});
} }
]);
[/code]
I made a video because I know my english is bad :) : http://6www.fr/jquerybug.swf
Can you help me on that ?
Thanks a lot!
Regards,
Maxime.
I have a little problem right with jQuery and Datatables.
A link click call a send_target() function :
[code]
Load
[/code]
Then, I call a PHP page which shows a table and I set call the Datatables plugin :
[code]
function send_target() {
var str = $("#submit_form").serialize();
$.ajax({
url: 'tasks/test.php?form='+str,
cache : false,
success: function(data) {
$('#display_targets').html(data);
// dataTable init
if($("#dt_example").length > 0) $.rloader([
{ type: 'css', src: 'templates/default/modules/datatables/css/demo_table_jui.css' },
{ type: 'js', src: 'templates/default/modules/datatables/js/jquery.dataTables.js', callback: function(){
$('#dt_example').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers"
});
} }
]);
}
});
}
[/code]
At the first click, it works great, but after the first click, it's like the plugin is not loaded. I tried to include the datatables loader in the PHP page, outside the ajax function, and I still have the same problem. If I reload the page, it works only at the first click too.
[code]
// dataTable init
if($("#dt_example").length > 0) $.rloader([
{ type: 'css', src: 'templates/default/modules/datatables/css/demo_table_jui.css' },
{ type: 'js', src: 'templates/default/modules/datatables/js/jquery.dataTables.js', callback: function(){
$('#dt_example').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers"
});
} }
]);
[/code]
I made a video because I know my english is bad :) : http://6www.fr/jquerybug.swf
Can you help me on that ?
Thanks a lot!
Regards,
Maxime.
This discussion has been closed.
Replies
Maybe it could help :
If I enter another element ID which is not a table during the initialisation, I have only one error message, I don't have one when I click a second time on the "Load" button.
Thanks.