Text wrap in the column
Text wrap in the column
as suggested i tried ellipsis plugin but it is not wrapping text and highlighting the row selection is also now working. Below given code please let me know how to get fixed these issues.
let table = $('#agentSelectionTable').DataTable({
data: availableAgents,
"columns": [{
"data": "userName"
},
{
"data": "firstName"
},
{
"data": "lastName"
},
{
"data": "startDate"
},
{
"data": "endDate"
},
{
"data": "replacementAgent"
},
{
"data": "comment"
}
],
columnDefs: [{
targets: 2,
render: $.fn.dataTable.render.ellipsis(10)
}],
"createdRow": function (row, data, index) {
if (data[5] != "") {
$('td', row).eq(5).addClass('highlight');
}
}
});
Answers
The ellipsis plugin works here with your code snippet:
http://live.datatables.net/kinelofi/1/edit
Since you are using objects, ie
columns.data
, you need to access the row data with object notation, not array notation. Change the above to this:If you still need help then post a link to your page or a test case replicating the issue so we can debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
if (data.replacementAgent != "") { - Is this condition for row selection?.
I see Ellipsis plugin working
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
This is the condition used to apply the
highlight
class.Kevin