Using DataTables with JScollPane
Using DataTables with JScollPane
timmalos
Posts: 3Questions: 0Answers: 0
Hi guys. First of all i will do my best to be clear but english is not my cup of tea, so sorry.
I Used DataTables for my Website and it's so nice that i would to use it in a website i'm building. The point is that i must use the Jquery plugin JScrollPane to make a 'Nice' Vertical ScrollBar that my client want.
And of course, it appears that the two plugins seems uncompatible, and i don't see why.
You can see more in the website himself : http://sqf-officine.fr/index.html. In this page everything is ok, but when i try to put the DataTable,this error is coming:
DataTables warning (table id = 'example'): Cannot reinitialise DataTable.
To retrieve the DataTables object for this table, please pass either no arguments to the dataTable() function, or set bRetrieve to true. Alternatively, to destory the old table and create a new one, set bDestroy to true (note that a lot of changes to the configuration can be made through the API which is usually much faster).
If I comment the lines of jScrollPane, DataTables works perfectly, no error, the error appears only when the two scripts are running at the same time.
[code]
$(function()
{
$('.scroll-pane').jScrollPane(
{
verticalDragMinHeight: 10,
verticalDragMaxHeight: 10,
}
);
});
oTable = $('#example').dataTable( {
"sDom": 'ftp',
"aaSorting": [[ 1, "asc" ]],
"bPaginate": true,
//"bJQueryUI": true,
"sPaginationType": "full_numbers",
"oLanguage": {
"sProcessing": "Traitement en cours...",
"sLengthMenu": "Afficher _MENU_ fichiers",
"sZeroRecords": "Aucun fichier
I Used DataTables for my Website and it's so nice that i would to use it in a website i'm building. The point is that i must use the Jquery plugin JScrollPane to make a 'Nice' Vertical ScrollBar that my client want.
And of course, it appears that the two plugins seems uncompatible, and i don't see why.
You can see more in the website himself : http://sqf-officine.fr/index.html. In this page everything is ok, but when i try to put the DataTable,this error is coming:
DataTables warning (table id = 'example'): Cannot reinitialise DataTable.
To retrieve the DataTables object for this table, please pass either no arguments to the dataTable() function, or set bRetrieve to true. Alternatively, to destory the old table and create a new one, set bDestroy to true (note that a lot of changes to the configuration can be made through the API which is usually much faster).
If I comment the lines of jScrollPane, DataTables works perfectly, no error, the error appears only when the two scripts are running at the same time.
[code]
$(function()
{
$('.scroll-pane').jScrollPane(
{
verticalDragMinHeight: 10,
verticalDragMaxHeight: 10,
}
);
});
oTable = $('#example').dataTable( {
"sDom": 'ftp',
"aaSorting": [[ 1, "asc" ]],
"bPaginate": true,
//"bJQueryUI": true,
"sPaginationType": "full_numbers",
"oLanguage": {
"sProcessing": "Traitement en cours...",
"sLengthMenu": "Afficher _MENU_ fichiers",
"sZeroRecords": "Aucun fichier
This discussion has been closed.
Replies
Allan
You 're right, DataTables seems to be initialised twice but impossible fr me to understand why.
The "Hello" is fire twice, and i don't have Javascript errors.
I put down the security of this page so that you can see: http://sqf-officine.fr/admin-bibliotheque.html
If you try to delete a document, you can see that two confirm() are fired, and one of them have an encode problem.
I now think this problem is not related to DataTables anymore but JScrollPane but if you have an idea to fix or bypass the problem, i take it.
Thx for all, your job is amazing.
Tim
The one thing which I'm a little unsure about is the code wrapped around be main block in admin.js:
[code]
$(function () {
...
} );
[/code]
Is this short hand for:
[code]
$(document).ready( function () {
...
} );
[/code]
What happens if you try the latter?
Allan