Problem with firebug and sAjaxSource and row details example

Problem with firebug and sAjaxSource and row details example

aaronwaaronw Posts: 89Questions: 3Answers: 4
edited August 2011 in Bug reports
So I have this, partial row details implemented:

[code]
var oTable = $('#example').dataTable( {
/* "aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] }
],
"aaSorting": [[1, 'asc']],
*/
"bJQueryUI" : true,
"bStateSave": true,
"sAjaxSource": 'iosload.php'

});
var nCloneTh = document.createElement( 'th' );
var nCloneTd = document.createElement( 'td' );
nCloneTd.innerHTML = '';
nCloneTd.className = "center";
nCloneTh.className="ui-state-default";

$('#example thead tr').each( function () {
this.insertBefore( nCloneTh, this.childNodes[0] );
} );

$('#example tbody tr').each( function () {
this.insertBefore( nCloneTd.cloneNode( true ), this.childNodes[0] );
} );
[/code]

The JSON is well formed (checked via JSONLINT) and it works fine when I don't try to do the row details example. This is on 3.6.13 firefox for Linux, if it matters.

When I just run the page straight up, it does make a new cell, but the cells don't seem to be propagated through the table. The example has the cloning and the insertion of the td cells before the call to dataTable(), but since I'm using the sAjaxSource, the table isn't there yet. The strange thing is when I use firebug to make some breakpoints on the .each functions of the thead or tbody, it does work. So I'm kind of baffled...

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    A hack that might work (since it seems to be a race condition, given the breakpoints make it work) is to run the inserts in a setInterval.
  • aaronwaaronw Posts: 89Questions: 3Answers: 4
    Well, I took out all the clone stuff and now I'm just working with the edit table extension:

    [code]


    $('td').editable('https://www.example.com/test/update.php');
    [/code]

    Again, it does not attach click handlers to the elements unless I put a breakpoint in firebug on that lline of the .editable function call, then it does. I installed the eventbug plug-in for firebug to be able to check on this sort of thing..... I'm really not sure what's going on...
  • aaronwaaronw Posts: 89Questions: 3Answers: 4
    So pulling it in chrome, it looks like the ajaxSource call has in fact not returned yet before it goes to do the other stuff like the editables and etc. It looks like I will need to look into fnServerData and put all of my post-data acquistion table manipulation the function that that can call.
  • aaronwaaronw Posts: 89Questions: 3Answers: 4
    So, not a bug, but damn these asynchronous programming paradigms! I am using fnInitComplete and I think that's doing the right thing. I did find a doc-bug, which I posted a follow up to an old conversation.
This discussion has been closed.