Using mRender to show thumbnail image whose path is made from 3 columns data
Using mRender to show thumbnail image whose path is made from 3 columns data
javismiles
Posts: 205Questions: 38Answers: 3
hi, im trying to use mRender on my table so that
i take the data of 3 columns and with them i build a path to a thumbnail pic that then i show on a new column,
i tried this but didnt work
$('#mtab').dataTable( {
"aaSorting": [[0,'desc']],
"sDom": "Tfprtip",
"sAjaxSource": "php/table.mtab.php",
"aoColumns": [
{
"mData": "id"
},
{
"mRender": function ( param1, param2, param3 ) {
thumb="http://www.domain.com/data/"+param1+"/picture"+param2+param3+".jpg";
return '';}
},
i take the data of 3 columns and with them i build a path to a thumbnail pic that then i show on a new column,
i tried this but didnt work
$('#mtab').dataTable( {
"aaSorting": [[0,'desc']],
"sDom": "Tfprtip",
"sAjaxSource": "php/table.mtab.php",
"aoColumns": [
{
"mData": "id"
},
{
"mRender": function ( param1, param2, param3 ) {
thumb="http://www.domain.com/data/"+param1+"/picture"+param2+param3+".jpg";
return '';}
},
This discussion has been closed.
Replies
@javismiles - mRender passes in three parameters:
It doesn't just conveniently pass in the three parameters you want ;-). You need to use the third parameter - something like
row.param1
,row.param2
, etc (assuming you call the third parameterrow
.Allan