I created a table with four columns, the first of which was an unnamed column (for images) that had a blank Header field (I did not "Allow sorting" on this column). The other three columns had labeled Headers. The second column, "Last Name" was the default sorting column (ascending). The other two columns were "First Name" (no sorting allowed) and "Year" (sorting allowed).

When the table is displayed with <?php print tablemanager_display(3); ?>, no default sorting on the second (default sort) column takes place (sorting does work if the column headings are clicked).

Workaround: If I set &nbsp; as the Header field for the first (unnamed) column, default sorting takes place as it should when the table is displayed.

Comments

BayouBill’s picture

Above applies to tablemanager.module,v 1.71 2006/08/15 20:28:32 and Drupal 4.7.3

pobster’s picture

Not me I'm afraid, you should post a bug report to core:

$rows[] = array('Cell 1', 'Cell 2', 'Cell 3', 'Cell 4');
$rows[] = array('Cell 5', 'Cell 6', 'Cell 7', 'Cell 8');
$rows[] = array('Cell 9', 'Cell 10', 'Cell 11', 'Cell 12');
$rows[] = array('Cell 13', 'Cell 14', 'Cell 15', 'Cell 16');
print theme('table', array('', array('data' => 'Last Name', 'sort' => 'asc', 'field' => '2'), 'First Name', array('data' => 'Year', 'field' => '4')), $rows);

If you change the 'asc' to 'desc' the order doesn't change.

Pobster

BayouBill’s picture

I don't understand the implications of your message. What should I report as being "broken" in core?

pobster’s picture

tablesort.inc or perhaps theme.inc (theme handles the table call and tablesort handles the table sorting)

http://cvs.drupal.org/viewcvs/drupal/drupal/includes/tablesort.inc?view=...
http://cvs.drupal.org/viewcvs/drupal/drupal/includes/theme.inc?view=markup

All tablemanager does is to automate passing information to theme 'table' - I already have to 'fudge' several things because of the weird way Drupal works - I guess I can fudge that an empty header cell will contain ' ' but tbh, I'm not likely to bother fixing something like that in a hurry...

Pobster

BayouBill’s picture

Okay, I've posted it as a Drupal issue at http://drupal.org/node/84349

pobster’s picture

Status: Active » Closed (fixed)