Sorting columns with images

Sorting columns with images

hasanhasan Posts: 1Questions: 0Answers: 0
edited November 2011 in General
Hi,

My question is about sorting a column with an image in it.
I have a table like this:

username | carded | refused | waiting | accepted

USERNAME| Y | N | N | Y

and so on...

I am using images for Y/N bits (small PNG circles like red and green lights)

if I place the image straight in the DataTables doesn't sort that column, even though I have ALT and TITLE attributes exist as (Yes or No)

When I added a hidden span (YES) obviously it works but I don't want to add extra markup as these tables will be generated dynamically and there are LOADS of them.

Any idea is appreciated.

Thanks.

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    force that column to sort as string. it should work.

    http://www.datatables.net/usage/columns#sType

    it was probably auto-detecting 'html' type, which strips/ignores the html

    [code]
    "aoColumnDefs": [
    { "sType": "string", "aTargets": [ 0 ] }
    ]
    [/code]
This discussion has been closed.