drvic10k / bootstrap-sortable

adding sorting ability to bootstrap table
MIT License
512 stars 131 forks source link

Sorting and colspam #49

Closed Paul0079 closed 9 years ago

Paul0079 commented 9 years ago

I've read the following:

Cell with colspan and multiple header rows

When you have cell with colspan, by default, the first column of the span will be sorted. You can override this by using data-mainsort attribute for the column that you want to be sorted with the colspan cell.

However I don't get the following working:

<table class="table table-bordered sortable">
<thead>
    <tr class='active'>
        <TH class='text-center' colspan=2>Gift name</TH>
        <TH class='text-center'>Gift type</TH>
    </tr>
</thead>

<tbody>
    <td class='hidden-xs' width=1%>
        <a href="http://www.steamgifts.com/giveaway/mScH1/cubemen-2"><img src='http://cdn.akamai.steamstatic.com/steam/apps/295850/capsule_sm_120.jpg'></a>
    </td>
    <td data-mainsort><a href="http://www.steamgifts.com/giveaway/mScH1/cubemen-2">Cubemen 2</a></td>
    <td>Bundle game</td>
</tbody>
</table>

The sorting is just not working when I put a 'colspan' on the TH header.

drvic10k commented 9 years ago

this is only meant for two levels of header, so that you can sort the columns by clicking on the top header

Paul0079 commented 9 years ago

OK, so is it possible to add the functionality to handle a 1 level header with a colspan?

drvic10k commented 9 years ago

it should be possible, I will look at it

mikla commented 9 years ago

+1