drvic10k / bootstrap-sortable

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

Sorting multi-row items #121

Closed tcz closed 5 years ago

tcz commented 6 years ago

I have a table in the following structure:

        +-----+-----+-----+
Header:   TH  | TH  |  TH
        +-----+-----+-----+
Item 1:   TD  |  TD |  TD
        +-----+-----+-----+
                 TD
        +-----+-----+-----+
Item 2:   TD  |  TD |  TD
        +-----+-----+-----+
                 TD
        +-----+-----+-----+

Each item takes up 2 rows, he 2nd row contains "notes" about the item so it has a colspan of the column number of the table.

I'd like this table to be sortable, but in the default implementation, the "notes" rows remain in their place after sorting (the non-notes rows are sorted properly).

Is there a way this can be done? Thanks!

hankur commented 5 years ago

I had a similar issue, actually, and I "solved" it by moving the second rows after their main rows using the sorted event. You can see how this works in the JSFiddle I made: https://jsfiddle.net/tr4hd2k8/