DataTables error with dynamic table row details
I am using DataTables for a dynamically generated table (via ajax calls). The table by itself works fine but gives null exceptions with row details (works fine first time though), which point to the jquery.datatables.js code line 5388, after the first call: "s is null on line:
for ( i=开发者_开发技巧s._iDisplayStart, iLen=s._iDisplayEnd ; i<iLen ; i++ )"
Somewhere in your code you attach .live
event handler. You have to use .die
to unset it. Else you will get the error.
Based on the code provided, I bet that your image that you're clicking to expand/contract the rows is not the same as the image path you provided in this group of code:
/* Open this row */
this.src = "../examples_support/details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
Check your path and image name in this.src and ensure that it's proper. Firebug or Chrome debugger are great ways to double check.
Working after I moved the row details click event methods to document.ready()
精彩评论