0

I'm outputting some data from a custom module as follows

theme('table', array('rows' => $rows, 'header' => $headers ));

to a custom /admin page that will be viewed using the Administrative theme.

Problem is that the headers are generated as (a) clickable and (b) the selected columns have up/down sort arrows. But when you click on the arrows, no sorting happens.

How can I either remove this styling from the header, or implement a sort for the table?

1 Answer 1

1

Found the answer by reading this fine article

https://knackforge.com/blog/karalmax/drupal-7-creating-drupal-style-tables-paging-sorting-and-filter

"If you do not want a particular column to be sortable, do not specify the 'field' parameter for its header."

My headers array is now simply

   $headers = array(
      array('data' => 'UID'),
      array('data' => 'Username'),
      array('data' => 'Given Name'),
      array('data' => 'Family Name'),
      array('data' => 'Email Address')
    );

with no 'field' value specified, and the clickable headers have disappeared.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.