row details server side won't fire

row details server side won't fire

derocchaderoccha Posts: 9Questions: 1Answers: 0
edited October 2013 in General
I try to use row details on server side but my click function doesn't gets fired inside document ready. Beacuse of obsolations of live I have been changing to .on and my codes looks as it follows

[code]$('table#feed_products.edit').on('click', '.edit', function() {
alert('test');//heres nothing
var nTr = $(this).parents('tr')[0];
if (oTable.fnIsOpen(nTr))
{
/* This row is already open - close it */
this.src = "";
oTable.fnClose(nTr);
}
else
{
/* Open this row */
this.src = "";
oTable.fnOpen(nTr, fnFormatDetails(nTr), 'details');
}
});
[/code]

Replies

  • newtonnewton Posts: 3Questions: 0Answers: 0
    Hi,
    Did you try to add this function inside fnDrawCallback?

    [code]
    $('#dataTableMygAdv').dataTable(
    {
    "fnDrawCallback": function (oSettings)
    {
    $('table#feed_products.edit').on........
    },
    .
    .
    });

    [/code]
  • derocchaderoccha Posts: 9Questions: 1Answers: 0
    thank you for feedback I've been trying but even like that won't work
  • derocchaderoccha Posts: 9Questions: 1Answers: 0
    the hole code looks as it follows
    [code]
    var oTable;
    /* Formating function for row details */
    function fnFormatDetails(nTr)
    {
    var aData = oTable.fnGetData(nTr);
    $(nTr).fadeOut();
    console.log(aData[1]);
    alert('data test');
    var sOut = '';
    $('#edit_prod_settings_' + aData[1] + '').load('../admin/?controller=products&action=getProdDetails&prod_id=' + aData[1]);

    return sOut;
    }


    $(document).ready(function() {

    oTable = $('#feed_products').dataTable({
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "../admin/?controller=products&action=getTable",
    "aoColumns": [
    {"sClass": "center", "bSortable": false},
    null,
    {sWidth: '20%'},
    null,
    null,
    null,
    null,
    {"sClass": "center", "bSortable": false},
    {"sClass": "center", "bSortable": false, sWidth: '5%'},
    {"sClass": "center", "bSortable": false}
    ],
    "aaSorting": [[1, 'asc']],
    "fnDrawCallback": function(oSettings)
    {
    $('table#feed_products.table tbody tr.odd td.center button.edit').on('click', function() {

    var nTr = $(this).parents('tr')[0];
    if (oTable.fnIsOpen(nTr))
    {
    /* This row is already open - close it */
    this.src = "";
    oTable.fnClose(nTr);
    }
    else
    {
    /* Open this row */
    this.src = "";
    oTable.fnOpen(nTr, fnFormatDetails(nTr), 'details');
    }
    });
    }
    });
    });
    [/code]
This discussion has been closed.