StupidTable with settings

This page shows how specific behaviors can be introduced by providing settings to StupidTable. View the source of this page to see the settings in use.


Example 1

This table does not redraw when attempting to sort a column that has identical values in all rows.

int float string int (identical)
15 -.18 banana 99
95 36 coke 99
2 -152.5 apple 99
-53 88.5 zebra 99
195 -858 orange 99

var $table = $("#example-1");
$table.stupidtable_settings({
    should_redraw: function(sort_info){
      var sorted_column = sort_info.column;
      var first_val = sorted_column[0];
      var last_val = sorted_column[sorted_column.length - 1][0];

      // If first and last element of the sorted column are the same, we
      // can assume all elements are the same.
      return sort_info.compare_fn(first_val, last_val) !== 0;
    }
});
$table.stupidtable();