Unable to re-initialise DataTable. Please use the API to make any configuration changes required.

Unable to re-initialise DataTable. Please use the API to make any configuration changes required.

comincomin Posts: 2Questions: 0Answers: 0
edited March 2010 in General
hi allan,my English is poor.so I as simple as possible to say my problem.








var oTable;

$(document).ready(function() {

oTable = $('#tt').dataTable({
"bProcessing": true,
"bAutoWidth": false,
"bSortClasses": false,
"bStateSave": false,
"aoColumns": [{ "bSortable": false,"sWidth": "5%" },{ "sWidth": "10%" },{ "sWidth": "25%" },{ "sWidth": "25%" },{ "sWidth": "5%" },null,null ],
"sPaginationType": "full_numbers",
"sDom": 'Tlfrtip',
"sAjaxSource":'1.xml'
});

var aa = $("#tt").dataTable().fnGetNodes();

$(aa).hover(function(){$(this).addClass("over")},function(){$(this).removeClass("over")}).click(function(){$(this).toggleClass("clk")})
} );









title1
title2
title3
title4
title5
title6






the contents of 1.xml is the same to json_source.txt

now?ctrl+F5 my webpage , alert that:DataTables warning: Unable to re-initialise DataTable. Please use the API to make any configuration changes required.

but $(aa).hover(function(){$(this).addClass("over")},function(){$(this).removeClass("over")}).click(function(){$(this).toggleClass("clk")}) is worked!

i hope i can Expressed my problem clearly. and i hope you can tell me the answer.

thank you very much!

Replies

  • allanallan Posts: 61,903Questions: 1Answers: 10,148 Site admin
    Try:

    [code]
    var oTable;

    $(document).ready(function() {

    oTable = $('#tt').dataTable({
    "bProcessing": true,
    "bAutoWidth": false,
    "bSortClasses": false,
    "bStateSave": false,
    "aoColumns": [{ "bSortable": false,"sWidth": "5%" },{ "sWidth": "10%" },{ "sWidth": "25%" },{ "sWidth": "25%" },{ "sWidth": "5%" },null,null ],
    "sPaginationType": "full_numbers",
    "sDom": 'Tlfrtip',
    "sAjaxSource":'1.xml'
    });

    var aa = oTable.fnGetNodes();

    $(aa).hover(function(){$(this).addClass("over")},function(){$(this).removeClass("over")}).click(function(){$(this).toggleClass("clk")})
    } );
    [/code]
    Note that the change is in the assignment of the var aa.

    Allan
  • comincomin Posts: 2Questions: 0Answers: 0
    Thank you! The problem has been solved?You are a very good man! Please forgive my poor English?
  • allanallan Posts: 61,903Questions: 1Answers: 10,148 Site admin
    Hah - your English is absolutely fine. One post to solve the problem - I'd say you communicated very well indeed :-)

    Good to hear that worked for you.

    Regards,
    Allan
This discussion has been closed.