DataTables logo DataTables

via Ad Packs
Events binding on elements in "details" pane do not work
  • Hello,

    I have some <p>, <span> and <div> elements within the details row... I'm unable to bind any hover/click/whatever events on them... I read the FAQ and using fnDrawCallback/fnInitComplete works for all elements within the datatable but the details row.

    /* Formating function for row details */
    function fnFormatDetails ( nTr )
    {
            var aData = oTable.fnGetData( nTr );
            sOut = '<div class="uTags">'+aData[8]+'</div>';
            sOut += '<div class="sTags">'+aData[7]+'</div><p>test</p>';
            return sOut;
    }
    

    What am I missing? Data comes from ajax source... Help is appreciated...!
  • Sorry for pushing this, but...

    "I read the FAQ and using fnDrawCallback/fnInitComplete works for all elements within the datatable but the details row."

    @Allan: Can you reproduce the issue?
  • jeronejerone
    Posts: 12
    You probably have executed some code that adds hover/click events on every row. The problem is that your new html (sOut) is injected in the DOM when the details is opened. Those events will then not be added.
    The solution is to use the "live" eventhandler in jQuery: http://api.jquery.com/live/
  • kkudikkudi
    Posts: 74
    yes, jerone's suggestion should do the trick
    use live instead of bind or the event shortcut.
This discussion has been closed.
← All Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Support

Get useful and friendly help straight from the source.

In this Discussion