Ellipsis for multiple columns
Ellipsis for multiple columns
![colbroth](https://secure.gravatar.com/avatar/93d257ceba76bd157e420425bc525792/?default=https%3A%2F%2Fvanillicon.com%2F93d257ceba76bd157e420425bc525792_200.png&rating=g&size=120)
I was attempting to use the DataTables configuration to use ellipsis for long names on multiple columns as show in your example at https://datatables.net/reference/option/columns.render. If I set targets to multiple columns (i.e. targets: [0,1]), it will duplicate the column values. For instance, setting targets to [0,1] will put all the values from column 1 into column 0.
See fiddle at http://jsfiddle.net/colbroth/Leo3xvwz/.
Could you please direct me to a solution where I can set the multiple columns to use ellipsis? I would like a generic solution since our application has multiple tables and only certain columns will have long names. The tables differ in which columns have long names.
This question has an accepted answers - jump to answer
Answers
I think it will work correctly if you remove the 'data' option:
It seems that is setting the data source to
description
for both columns causing them to have the same data.Kevin
That's exactly what it is doing.
You can have multiple
columnDefs
objects for a single column, so you could list thecolumns.data
option in a different object, but for that sort of thing I tend to usecolumns
for the individual properties andcolumnDefs
for the grouped ones.Allan