A module I am working on needs to be able to display a table sorted by default using a column that is not to be visually displayed.

This is easy to do with the following code

$sql .= tablesort_sql($header, $hidden_sort_column);

This has a minor problem that the tablesort theming code adds a sort direction arrow to the default column when it cant find the correct column in the header.

To workaround this, the attached patch allow URLs to provide the hidden order, or it can be defined in the module code using:

if (!isset($_GET['order']))
  $_GET['order'] = t($hidden_label);
CommentFileSizeAuthor
drupal-table-order-hidden.patch632 byteszeroj

Comments

magico’s picture

Version: 4.6.3 » x.y.z
Category: bug » feature
LAsan’s picture

Version: x.y.z » 7.x-dev

Does this patch still applies to current version.

Feature request moving to cvs.

lilou’s picture

Status: Active » Needs work

Patch no longer applied.

dave reid’s picture

Status: Needs work » Fixed

This is no longer necessary with DBTNG.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.