Insert images into data array and add url

Insert images into data array and add url

jagswebjagsweb Posts: 26Questions: 6Answers: 0
edited May 2014 in DataTables 1.10

I am using datatables to display a ton of year/make/model information for an auto part manufacturer.

i have the table up and running and it works great. http://www.pacesetterexhaust.com/cat-data.html

i added child rows and I need a product thumbnail to appear in the child row. I found something on the internet somewhere that said to format it like

{
    "PartNumber": "754100",
    "LongDesc": "Pacesetter Manifold Converter",
    "Year": "2001",
    "Make": "SATURN",
    "Model": "SC2",
    "Engine": "1.9L (116ci) L4",
    "Thumb": "src='images/products/thumb/754100.jpg'",
    "Location": "Front"
  },
  {
    "PartNumber": "754100",
    "LongDesc": "Pacesetter Manifold Converter",
    "Year": "2002",
    "Make": "SATURN",
    "Model": "SC2",
    "Engine": "1.9L (116ci) L4",
    "Thumb": "src='images/products/thumb/754100.jpg'",
    "Location": "Front"
  },

the image will not appear in the row at all. The only thing that appears is src='images/products/thumb/754100.jpg'

Am i formatting this incorrectly?

I also need to wrap the part number in a url so that the part numbers are linked to our product pages.

Thanks for your assistance

Joe

Answers

  • jagswebjagsweb Posts: 26Questions: 6Answers: 0
    edited May 2014

    Was able to add the image to the child row using two steps

    first: changed the child row info in the script to

      '<td rowspan="3"><img src="' + d.Thumb + '"/></td>'+
    

    second: I changed the text in my datafile for the thumb to
    "Thumb": "images/products/thumb/201008.jpg",

    I basically revised that just a little for the url. I had to put it in the child row, which is not really what I wanted, but it looks good anyway.

This discussion has been closed.