Jquery 如何在数据表中显示图像?
我想在我的datatable中显示一个图像。datatable中显示的数据是一个json数组,数组如下:Jquery 如何在数据表中显示图像?,jquery,json,datatables,Jquery,Json,Datatables,我想在我的datatable中显示一个图像。datatable中显示的数据是一个json数组,数组如下: data : [["1", "John","image1.jpg"], ["2", "Jim", "image2.jpg"]] 因此,在我的数据库中,我只有图像的名称,我不知道如何显示图像本身。以前有人问过,但没有简单的数组datasrc。使用columnDefs以图像的索引为目标,使用render构建' } } ] }) 另请参见 我的一个经验是如何打印,然后我发现条带h
data : [["1", "John","image1.jpg"], ["2", "Jim", "image2.jpg"]]
因此,在我的数据库中,我只有图像的名称,我不知道如何显示图像本身。以前有人问过,但没有简单的数组datasrc。使用
columnDefs
以图像的索引为目标,使用render
构建'
}
}
]
})
另请参见
我的一个经验是如何打印,然后我发现条带html:false如下
"buttons": [
{
extend: 'print',
title: 'nono nonono',
exportOptions: {
columns: ':visible',
stripHtml: false,
},
text: '<i class="fa fa-print"></i> Print',
customize: function (win) {
$(win.document.body)
.css('font-size', '10pt')
.prepend(
'<img src="" style="position:absolute; top:0; left:0;" />'
);
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
}
},
]
“按钮”:[
{
扩展:“打印”,
标题:“nono nono”,
出口选择:{
列:':可见',
stripHtml:false,
},
文本:“打印”,
自定义:功能(win){
$(win.document.body)
.css('font-size','10pt')
.预编(
''
);
$(win.document.body).find('表')
.addClass('compact')
.css('font-size','inherit');
}
},
]
您好,您可以参考这个和这个