Table inside td

Table inside td

islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1
edited June 2018 in Free community support

I had a question. Can datatables work this table :

<table>
  <thead>
    <tr>
       <th></th>
       <th>Title</th>
       <th>Title</th>
       <th>Title</th>
       <th>Title</th>
       <th>Title</th>
       <th>Title</th>
       <th></th>
       <th></th>
       <th></th>
       <th></th>
    <tr>
  </thead>
  <tbody>
    <tr>
       <td aria-expanded="false" data-toggle="collapse" data-target="#collapse1" style="cursor: pointer;"><span class="glyphicon glyphicon-chevron-right"></span><span class="glyphicon glyphicon-chevron-down"></span></td>
       <td>Stuff</td>
       <td>Stuff</td>
       <td>Stuff</td>
       <td>Stuff</td>
       <td>Stuff</td>
       <td>Stuff</td>
       <td><insert button here></td>
       <td><insert button here></td>
       <td><insert button here></td>
       <td><insert form here></td>
    <tr>
    <tr>
       <td></td>
       <td colspan="10"><insert table here></td>
    <tr>
  </tbody>

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @islamelshobokshy ,

    The best bet is to give it a try in the sandpit, you can experiment with various options and customisations.

    Cheers,

    Colin

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1
    edited June 2018

    Well it doesn't work in my own code that's why I'm asking if it's possible or not :tongue:

    I get an Uncaught TypeError: Cannot read property 'className' of undefined, as Datatables is looking for 11 <td> in each <tr>, and doesn't like having in a <tr> 1 <td> and in another <tr> a <td> that fills the space of 10 others ... Can I tell datatables to sort only each modulo 2 <tr> ? :smiley:

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    Yep, the table is expected to be constant width, so you'll either need to prescan the table and remove those smaller columns, or pad them out so they'll fit.

    Cheers,

    Colin

This discussion has been closed.