fnOpen throwing error!

fnOpen throwing error!

bradley32bradley32 Posts: 16Questions: 0Answers: 0
edited April 2011 in General
Hello dataTables community!
So I have a page where single or multiple dataTables are being called in via AJAX.

On page load, when a single table is called in, the fnOpen function works like a charm displaying the duplicate articles below the row when the "+" sign is clicked.

However, on page load when 2 or more tables are called in the fnOpen function does not work and throws this error:
b.aoData[a] is undefined

This also occurs when loading a table via AJAX without a page refresh by using a select dropdown menu.

Here is the code that I am using for the link:

[code]
$('#table_container .dup_toggle').live('click', function () {
var nTr = this.parentNode.parentNode.parentNode;

var docId = $(this).attr('id');

$(this).toggleClass('active');

if (!$(this).hasClass('active') ){
agentTable.fnClose( nTr );
} else {
agentTable.fnOpen( nTr, mw.mnews.agents.getDuplicates(data, tableId, agentTable, nTr, docId, agentId), 'duplicates' );
}
});
[/code]

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Any chance you can give us a link? I don't immediately see what would be causing an issue there - could you double check that nTr is a TR element (you could use $(this).parents('tr')[0] to get it for certain).

    Allan
  • bradley32bradley32 Posts: 16Questions: 0Answers: 0
    Hi Alan!
    Thanks for the reply mate :)

    I don't have a link that I can provide we are in mid-development on a SAAS application.

    The weird thing is that it works when called in via AJAX on page load and there is only one table...when there is multiple tables it doesn't...

    I will have another pair of eyes look at it here for me and get back to you on the results :)

    Thanks again bro!
    Brad
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    When you are using multiple tables - which one does 'agentTable' point to? By default it will use only the first table (this can be changed using iApiIndex) - thus your function will only work on the first table. You would need a second function to be defined for the second table I think.

    Allan
  • bradley32bradley32 Posts: 16Questions: 0Answers: 0
    Right, that makes sense. However, even when I select a new option from the select menu and AJAX in a single table, the same error is thrown...

    Brad
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Hmm - I'm not 100% sure what is going on I'm afraid. If you use the unminified version of DataTables - what is the error that is given, and what line is it on? Also what version of DataTables are you using?

    Allan
  • bradley32bradley32 Posts: 16Questions: 0Answers: 0
    Hey Allan,

    I am using DT version 1.7.6

    The error given is:

    s is null
    jquery.datatables-1.7.6.js

    Line 5169

    Any ideas?

    Thanks for all the help. Donations coming amigo!

    Brad
  • bradley32bradley32 Posts: 16Questions: 0Answers: 0
    edited May 2011
    Still having issues...let me know if you have paid support please!

    Thanks!
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Hi Brad,

    Sorry for the delayed reply. Paid support is done by the 'Support' button at the top of this page. If you make a donation (rather than a support package - which might come soon!) and enter the thread number, it allows me to track which threads get priority :-)

    So 's' in this case is the settings object for the DataTable. The fact that it is null is bad since it means that DataTables doesn't know what is going on basically (there are no settings for it to operate on!). That would suggest to me that either 'agentTable' has changed, or the iApiIndex property of DataTables has been changed.

    Could you show me how you initialise agentTable and the second table?

    Thanks,
    Allan
  • bradley32bradley32 Posts: 16Questions: 0Answers: 0
    Hi Allan,
    Thanks for all the help! I figured it out. I was using the .live function and changed it to .bind and everything is working now : )

    Brad
  • BoZoBoZo Posts: 6Questions: 0Answers: 0
    Hi Brad, i would know what you mean with live and bind function? i have the same problem and don't know how to solve it
This discussion has been closed.