Text wrap in the column

Text wrap in the column

genesys_kumargenesys_kumar Posts: 24Questions: 6Answers: 0

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

  • kthorngrenkthorngren Posts: 21,426Questions: 26Answers: 4,969

    The ellipsis plugin works here with your code snippet:
    http://live.datatables.net/kinelofi/1/edit

    if (data[5] != "") {
    

    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 (data.replacementAgent != "") {
    

    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

  • genesys_kumargenesys_kumar Posts: 24Questions: 6Answers: 0

    if (data.replacementAgent != "") { - Is this condition for row selection?.

    I see Ellipsis plugin working

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    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

  • kthorngrenkthorngren Posts: 21,426Questions: 26Answers: 4,969

    if (data.replacementAgent != "") { - Is this condition for row selection?.

    This is the condition used to apply the highlight class.

    Kevin

Sign In or Register to comment.