Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip certain rows when sorting #118

Open
pelcasandra opened this issue Jul 5, 2014 · 1 comment
Open

Skip certain rows when sorting #118

pelcasandra opened this issue Jul 5, 2014 · 1 comment

Comments

@pelcasandra
Copy link

I have a list of rows sorted by default, and they have a expand button. When clicked, it shows a few <tr><td>...</td</tr> rows hidden.

Problem is that, since rows are sorted by default, these are displayed inconsistently above the clicked row instead of below.

stupidtable

Is there any way to skip certain <tr><td>...</td</tr> from being ordered or preferently stick always under a parent sortable row?

@cptOneEye
Copy link

Just if someone is interested. I added attributes data-id an data-parentid to the rows. After sorting i reattached the subrows to the parent rows again:

  // Jquery
            var table = $('.mytable').stupidtable();

            table.bind('aftertablesort', function (event, data) {

                var subrows = $('tr.subrow');

                for (var i = 0; i < subrows.length; i++) {

                    var subrow = $(subrows[i]);
                    var parentrow = $('tr.parentrow[data-id="' + subrow.attr('data-parentid') + '"]');

                    subrow.insertAfter(parentrow);
                }
            });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants