Wrap only a single column in a specific table

Wrap only a single column in a specific table

ridwanhabbalridwanhabbal Posts: 2Questions: 1Answers: 0

Hi,

I'm using datatables for data grids. I have the global css set as white-space: nowrap; and it works fine.
However, only for a specific table there is only one column that I need to wrap text based on white spaces.
I tried to set inline css on the needed td but it doesn;t work (<td style="word-wrap: break-word;">${row.commentDetails}</td>)
Please take into account that I initially create the table without any rows, and based on the user selection of the parent table, I fill the specified table wit the data using datatables js APIs such as
notesTable.row.add( ['', SYSROWID, USERNAME, APPLICATIONNO, CATNO, WFUID, COMMENTDETAILS, PROCESSNAME, COMMENTDATEASINT, COMMENTDATE ] ).draw();

Please advise and please give detailed solution.

Thanks
Ridwan

Answers

  • ridwanhabbalridwanhabbal Posts: 2Questions: 1Answers: 0

    Hi there everybody

    any one would like to help?

    Thanks

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    so you have something like

    td {
        white-space: nowrap;
    }
    

    for global so trying this (I have not tested this)

    td {
        white-space: nowrap;
    }
    
    td.wrapok {
        white-space:normal
    }
    

    then in your definitions:

    $(document).ready( function () {
      var table = $('#example').DataTable({
        columnDefs:[{targets:[0], class:"wrapok"}]
      });
    } );
    
This discussion has been closed.