TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ayesha Fathima
NA
184
29.7k
Give hyperlink on image column in data table
Feb 7 2018 4:46 AM
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
'<img src="wcp/theme/default/icon/action/star_icon1.png" />'
;
}
else
if
(starflag==
"0"
)
{
return
'<img src="wcp/theme/default/icon/action/star_yellow.png" />'
;
}
}
function
test()
{
alert(
"test"
);
}
Reply
Answers (
1
)
Refresh Data table with new data set
Get whole row data onclick of cell