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

Added 'data-sort-ignore' so we can exclude certain <tr> in the sorting #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ollejacobsen
Copy link

@ollejacobsen ollejacobsen commented Apr 26, 2016

This change is Reviewable

@tomsommer
Copy link

+1

@joequery
Copy link
Owner

joequery commented Nov 5, 2016

Hi there. What is the use case for this?

@ollejacobsen
Copy link
Author

Tag one/many row that will be sticky. In my case I needed the top row to be
ignored when sorting.
You can see a sample of this here on the top .. directory.

http://corebrowser20161026075844.azurewebsites.net/Images

Kind regards,
Olle

Den 5 nov. 2016 17:28 skrev "Joseph McCullough" [email protected]:

Hi there. What is the use case for this?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#163 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAp8XHhtYXXhJf4JD6Y2PJB1SHeZuQWRks5q7K6cgaJpZM4IQUpv
.

@yairEO
Copy link

yairEO commented Sep 6, 2017

it's pretty easy to fix this manually. My solution:

pass a settings to the plugin, which I called skipRowsSelector and there one can pass a selector,
then you simply need to find all the tr elements which are not the skipRowsSelector

.find("tbody").find("tr").not(settings.skipRowsSelector)

@joequery
Copy link
Owner

joequery commented Sep 6, 2017

I think transforming this line into a settings function would allow this to be flexible enough to accommodate this request.

var trs = $table.children("tbody").children("tr");

Something like:

  $.fn.stupidtable.default_settings = {
    get_table_rows: function($table){
      return $table.children("tbody").children("tr");
    },
    ...
    ...
  };

And you could override this via

var $table = $("#mytable");
$table.stupidtable_settings({
    get_table_rows: function($table){
        return $table.children("tbody").children("tr").slice(1);
    }
});
$table.stupidtable();

This issue was created before the stupidtable_settings was introduced, but I think the settings infrastructure can accommodate it well.

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

Successfully merging this pull request may close these issues.

4 participants