Can I show two images in one cell?

Can I show two images in one cell?

JohannesRJohannesR Posts: 2Questions: 2Answers: 0

I am using the render function two show one image in a cell, but for some rows I need two or more images in the same cell. I can't put them in different cells and the number of images varies.

Is there a possibility to do this with DataTables/HTML?

{ targets: 7,
render: function ( data, type, row, meta ) {
return <a href="${tableDataSet[meta.row][7][0]}/"><img id="image" src="${tableDataSet[meta.row][7][1]}" width="${tableDataSet[meta.row][7][2]*130}" height="${tableDataSet[meta.row][7][3]*130}"/></a>;
}
}

This is how I'm currently rendering one image in the cell (which is working).

Help is much appreciated.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,249Questions: 26Answers: 4,761
    Answer ✓

    Datatables doesn't control how many images you show in a cell. You just need to return a properly formatted HTML string to show the two images. You would have two img tags in your string and whatever else you want to display how you want.

    Kevin

This discussion has been closed.