Stupid-Table-Plugin
Stupid-Table-Plugin copied to clipboard
Added 'data-sort-ignore' so we can exclude certain <tr> in the sorting
+1
Hi there. What is the use case for this?
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 https://github.com/joequery/Stupid-Table-Plugin/pull/163#issuecomment-258622556, or mute the thread https://github.com/notifications/unsubscribe-auth/AAp8XHhtYXXhJf4JD6Y2PJB1SHeZuQWRks5q7K6cgaJpZM4IQUpv .
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)
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.