Datatables and its plugins and extras are really great.
In order to navigate from the table to some detailed page, I added a hidden column with a URL for each row and a click event listener in the fnDrawCallback (unless the td has a rowselect class).
Here is the callback code:
The problem is that the left fixed column is not part of the nTr nodes.
So, I thought to add some code in the fixed columns fnDrawCallback itself but I don't know how to link with to the extra data stored in the hidden column.
Would someone have an idea ?
Thank you.
In order to navigate from the table to some detailed page, I added a hidden column with a URL for each row and a click event listener in the fnDrawCallback (unless the td has a rowselect class).
Here is the callback code:
"fnDrawCallback": function(oSetting) { $(oSetting.aoData).each(function(index, element){ var colLienIndex = 2 ; $(element.nTr).children('td:not(:has(.rowselect))').unbind('click'); $(element.nTr).children('td:not(:has(.rowselect))').click(function(event){ if (event.ctrlKey) window.open(element._aData[colLienIndex]); else location.href = element._aData[colLienIndex]; }); }); },And here is a sample of the aaData:
[ "Dussillols Corinne","2255383","?mod=prestations&view=facture&action=detail&id=9","Pharmacie Agen Sud","AGEN","0,00","0,00","0,00"], [ "Wagner Philippe","","?mod=prestations&view=facture&action=detail&id=10","Pharmacie de la Place ","FALCK","0,00","0,00","0,00"], [ "Antoine Monique","2146974","?mod=prestations&view=facture&action=detail&id=11","Pharmacie Antoine-Appel","SARREGUEMINES","0,00","0,00","0,00"]As I have now lots of columns, I added the good FixedColumns extra.
The problem is that the left fixed column is not part of the nTr nodes.
So, I thought to add some code in the fixed columns fnDrawCallback itself but I don't know how to link with to the extra data stored in the hidden column.
Would someone have an idea ?
Thank you.