colspan without HTML
colspan without HTML
 ariuna            
            
                Posts: 2Questions: 1Answers: 0
ariuna            
            
                Posts: 2Questions: 1Answers: 0            
            Is there any possibility to use colspans hand multiple header rows without using HTML?
I need  to set it while initing the datatable with the "columns"-parameter.
Like:
$('.myTable').DataTable({
            bProcessing: true,
            bServerSide: true,
            paging: true,
            lengthMenu: [[25, 50, 100, 250, 500], [25, 50, 100, 250, 500]],
            pageLength: 100,
            order: [2],
            sAjaxSource: 'path/to/myAjaxController',
            sServerMethod: 'POST',
            columns: [
                { title: 'Col1', searchable: true, sortable: false },
                { title: 'Col2', searchable: true },
                { title: 'Col3', searchable: true, sortable: true },
                { title: 'Col4', searchable: true }
            ]
        });
Just with a second row of titles and a colspan. Like:
<table>
  <thead>
    <tr>
      <th colspan="2">Major-Col1</th>
      <th colspan="2">Major-Col2</th>
    </tr>
    <tr>
      <th>Col1</th>
      <th>Col2</th>
      <th>Col3</th>
      <th>Col4</th>
    </tr>
  </thead>
</table>
but without setting it in HTML. Only in the "columns"-parameter or in any other point of init of the datatable.
Thank you for your help :)
This question has an accepted answers - jump to answer
This discussion has been closed.
            
Answers
Not at this time - sorry. You need to set the colspan in the HTML. There is no option for DataTables to do it via the options just now.
Allan
Okay, thank you for the response.