i have one data table,on loading of data table i need to show some images based on some values in one column..and at the same time onclick of that column i need to change that image..it's like falg an dimportant columns in our gmail..At present iam able to show images based on some conditions using "render: getStarredflag,".But on that same column i need to give hyperlink also on click of which we need to update db and change the image.
This is what i have tried,sample code.How to give hyperlink and call test() function onclick of that image column.??
- Getmaildetailstable = $('#Getmaildetailstable').DataTable({
- columnDefs: [{
- orderable: false,
- className: 'select-checkbox',
- defaultContent: "",
- targets: 0,
- visible: false
- }, {
- data: "image",render: getStarredflag,
- defaultContent: "",
- targets: 6,
- visible: true
- }
- order: [
- [2, 'asc']
- ],
- "searching": false,
- "lengthChange": true
- });
- function getStarredflag(data, type, full, meta) {
- var starflag=full.STARRED_FLAG;
- if(starflag=="1")
- {
- return '
';
- }
- else if(starflag=="0")
- {
- return '
';
- }
- }
- function test()
- {
- alert("test");
- }
Ayesha FathimaPosted Feb 7, 2018, 7:22 AM