problem with custom filter (re-drawing table): b is null

problem with custom filter (re-drawing table): b is null

vorreiesserlovorreiesserlo Posts: 1Questions: 1Answers: 0
edited September 2016 in Free community support

hi guys, here's my code (in a function i created called "drawTable"):

var oTable = $('#exampleTable').dataTable({
"bJQueryUI": false,
"aaData": external,
"bFilter": true,
"bPaginate": false,
"aoColumns": [{
"mDataProp": null,
'bSortable': false,
'aTargets': [-1],
"sClass": "control center",
"sDefaultContent": '<img class=\'addImg\' src="/Work/corse_taxi/PublishingImages/add-128.png">'
}, {
"mDataProp": "Utente"
},
{
"mDataProp": "Matricola"
}
,{
"mDataProp": "Cellulare", "bSortable":false
}, {
"mDataProp": "CDC"
},

{
  "mDataProp": "Totale"
}
],
"oLanguage": {
  "sInfo": "_TOTAL_ Occorrenze",
  "sSearch": "<span>Ricerca</span> _INPUT_" //search

},
"aaSorting": [

],

});

$('#exampleTable tbody td .addImg').live('click', function() {
var nTr = $(this).parents('tr')[0];
var nTds = this;

if (oTable.fnIsOpen(nTr)) {
  /* This row is already open - close it */
  this.src = "/Work/corse_taxi/PublishingImages/add-128.png";
  oTable.fnClose(nTr);
} else {
  /* Open this row */
  var rowIndex = oTable.fnGetPosition($(nTds).closest('tr')[0]);
  var detailsRowData = external[rowIndex].details;

  this.src = "/Work/corse_taxi/PublishingImages/minus-128.png";

  oTable.fnOpen(nTr, fnFormatDetails(iTableCounter, detailsTableHtml), 'details');

  oInnerTable = $("#exampleTable_" + iTableCounter).dataTable({
    "bJQueryUI": false,
    "bFilter": false,
    "aaData": detailsRowData,
    "aoColumnDefs": [
            {
"fnRender": function ( oObj ) {
 return '<a target=\'_blank\' href=\''+siteUrl+'/_layouts/listform.aspx?PageType=4&ListId={6880B218-0558-4F67-BD5E-DA6B7C2E386C}&ID='+oObj.aData.Identificativo+'&ContentTypeID=0x0100CADA4096A22F46428537898EE3AB1D3F00C5E06CE98616664DB47FBCABB2A70CB8\'><div class=\'divMagnify\'><img id=\'magnify\' src=\'/Work/corse_taxi/PublishingImages/magnifying-glass-icon-28.png\'></img></div></a>';
 },
"aTargets": [6]

},
],

    "aoColumns": [{
      "mDataProp": "DataChiusura"
    }, {
      "mDataProp": "Partenza", "bSortable":false
    }, {
      "mDataProp": "Arrivo", "bSortable":false
    },

    {
  "mDataProp": "Mese", "bSortable":false
},

{
"mDataProp": "Anno", "bSortable":false
},

    {
      "mDataProp": "Totale" 
    },
    {
        "mDataProp": "Identificativo", "bSortable":false
    }
    ],

    "aaSorting": [
                 ],

    "bPaginate": false,
    "oLanguage": {
      "sInfo": "_TOTAL_ Occorrenze"
    },
    "fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
      return nRow;
    }
  });
  iTableCounter = iTableCounter + 1;
}

});

i set a button called "reset" which would essentially call again the drawTable function, and indeed it does but then, when i click on the expanding button to showing the details table it gives me the "b is null" (and on top level something like: impossible to retreive the property aoOpenRows of a null) error.
any clue? i'm using: http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.0/jquery.dataTables.min.js

thank you, i'm almost to give up :(

This discussion has been closed.