jquery - Can't add img tag using Datatables JS -
i'm trying add image tag using mrender
in datatables js
. below aocolumns
initialization setting. second field works rendering <a>
anchor tag first field doesn't load href
in img
tag. shows broken image link in table. href
i've tried images/myimage.png
, /images/myimage.png
, ./images/myimage.png
, , ~/images/myimage.png
. i've tried full url http://localhost/images/myimage.png
. full url works if type in browser location field.
"aocolumns": [ {"mdataprop": "field1", "mrender": function (data, type, row) { if (parsefloat(data) > 50.00) { return "<img href='~/images/myimage.png' /> " + data; } else { return data; } } }, { "mdataprop": "field2", "mrender": function (data, type, row) { return "<a href='controller1/details/" + data + "'>details</a>"; } }],
img uses src-attribute file, not href.
Comments
Post a Comment