Using DataTables with JScollPane

Using DataTables with JScollPane

timmalostimmalos Posts: 3Questions: 0Answers: 0
edited December 2010 in Bug reports
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

Replies

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    I believe that the error is basically correct in that DataTables is being initialised twice (which you are seeing when you comment out the alert), the real question is why that it occurring... and from the code on the page and above, I don't immediately see why that is... If you add "alert('hello');" just before the line "oTable = $('#example').dataTable( {" - does it fire twice? Also when the code for DataTables is in there - do you get any Javascript errors?

    Allan
  • timmalostimmalos Posts: 3Questions: 0Answers: 0
    Hi 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
  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Interesting one - the alert seems to be shown first in one character set and then another for me which is very odd! There are one or two HTML parsing errors on the page, it might be worth fixing them, although I doubt it will impact what you are seeing.

    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
  • timmalostimmalos Posts: 3Questions: 0Answers: 0
    Seems to don't change anything.
This discussion has been closed.