BUG: ajax data and $( "# myTable").dataTable ()

BUG: ajax data and $( "# myTable").dataTable ()

mrdevmrdev Posts: 5Questions: 0Answers: 0
edited December 2009 in Bug reports
Sorry for my English

Hello, I have a problem: in general, there is a tabs, while clicking on the tab, I get the data ajax and put them in the table, and then want to tie dataTables, and swears that it does not see the data, decided to call $ ( "# myTable"). dataTable (); after receipt of data in the complete (Ajax), thought there take jquery.live, but it is not the type of event will not work, and the type of event where I do not need, how to get to see the data dataTable, and how to check have i instance or not

[code]
01.$.ajax({
02.type: “POST”,
03.cache: true,
04.url: host + “/includes/functions/bookmarkbody.php”,
05.data: “workpage=” + selectedTabID,
06.success: function(msg)
07.{
08. $(’#myTable’).html(msg);
09.},
10.complete: function()
11.{
12. $(”#myTable”).dataTable();
13.}
14.});
15.
16.},
17.selected: -1
18.});
[/code]
(FF)javascript console show errors
error: nThs is null
source: jquery.dataTables.js
string: 4669
this error showed when i call $( "# myTable"). dataTable (); before ajax data

and

error: sData is undefined
source: jquery.dataTables.js
string: 701

Replies

  • mrdevmrdev Posts: 5Questions: 0Answers: 0
    it was my bug
  • akmalkhonakmalkhon Posts: 15Questions: 0Answers: 0
    what was the mistake?
  • mrdevmrdev Posts: 5Questions: 0Answers: 0
    edited December 2009
    the error was in the inner loop (I do not know how it say in English , google's translator too :-D ), I have another question, I have a lot of tabs, all dynamic data, column headings and rows.
    There are several tabs, and for each tabs different data and different column headings,
    the transition to the tab ($('# myTable '). datatable ()), the transition to the next again ($('# myTable'). datatable ()), creates multiple instances of objects (another line search count of rows(select) etc.), how to remove the old instance

    [code]
    $("#bookmarks").tabs({
    fxFade: true,
    fxSpeed: 'slow',
    select: function(event, ui)
    {
    var selectedTabID = ui.panel.id;

    $.ajax({
    type: "POST",
    cache: true,
    url: host + "/includes/functions/bookmarkbody.php",
    data: "workpage=" + selectedTabID,
    success: function(msg)
    {
    $('#myTable').html(msg);
    },
    complete: function()
    {
    $("#myTable").dataTable();
    }
    });

    },
    selected: -1
    });
    [/code]
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Hi mrdev,

    I think if you could refer to your other thread for the discussion of the Ajax issue you are having ( http://datatables.net/forums/comments.php?DiscussionID=993&page=1#Item_3 ) rather than having the same discussion twice, that would be good :-).

    Regards,
    Allan
This discussion has been closed.