且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在数据表中为image列提供超链接

更新时间:2023-12-01 18:17:10

' #Getmaildetailstable')。DataTable({
columnDefs:[{
orderable: false
className:' select-checkbox'
defaultContent:
目标: 0
可见: false
},{
data: image,render:getStarredflag,
defaultContent:
目标: 6
可见: true
}
订单:[
[ 2 ' asc']
],
搜索 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/>';
}
其他 如果(starflag == 0
{
return ' < img src =wcp / theme / default / icon / action / star_yellow.png/>'跨度>;
}
}
function test()
{
alert( test);
}
('#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"); }


你有这样的代码

You have code like this
if(starflag=="1"){
return '<img src="wcp/theme/default/icon/action/star_icon1.png" />';
}



像这样更改


change it like this

if(starflag=="1"){
return '<img src="wcp/theme/default/icon/action/star_icon1.png" onclick="test()" />';
}