Onclick event in columnDefs

Onclick event in columnDefs

jim1506jim1506 Posts: 5Questions: 4Answers: 0

I have a datatable populated by 4 fields via a Laravel route. That is fine and works great.

Additionally I have added 2 columns with icons, again that is fine. One is to show a sliding panel of information and one will be a link to more details.

I show these by rendering column info.

I wish to have an onlick event for one which will use the data in column 0 which is a key field. I have tried:

{ "targets": [4], "render": function ( data, type, full, meta ) { {return '<div align="center"><a href="#"><img src="{{ asset("siteicons/Info_Box_Blue.png") }}" id="trigger" onclick="ShowSlider( {{ ' + 0 + '}} )"></a></div>';} } },

This is in the columnDefs, but clicking does not do anything - even if I put a simple alert.

Help, please!

This discussion has been closed.