How to use colspan to buttons
How to use colspan to buttons
mudolrd
Posts: 1Questions: 1Answers: 0
Hey im trying create a simple table
<thead>
<tr>
<th>Name</th>
<th colspan="2" class="text-center">Tools</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name</td>
<td class="text-center">
<a href="" class="btn btn-info">
<i class="fa fa-pencil"></i>
</a>
</td>
<td class="text-center">
<a href="" class="btn btn-danger">
<i class="fa fa-trash-o"></i>
</a>
</td>
But I got "TypeError: c is undefined"
If i change it to
<thead>
<tr>
<th>Name</th>
<th class="text-center">Tools</th>
<th class="text-center">Tools</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name</td>
<td class="text-center">
<a href="" class="btn btn-info">
<i class="fa fa-pencil"></i>
</a>
</td>
<td class="text-center">
<a href="" class="btn btn-danger">
<i class="fa fa-trash-o"></i>
</a>
</td>
It worked
Can anyone help me, Thank You
This discussion has been closed.
Answers
Colspan is supported with Datatables but there also needs to be one TH cell per column. This is described in this example:
https://datatables.net/examples/basic_init/complex_header.html
In your case why don't you put both buttons into one column and not use colspan?
Kevin
You could also have an additional header cell with nothing in it which would work. As Kevin rightly says, there needs to be a unique cell for each column in the table.
Allan