0

An odd question: I have a custom column added to the default admin/content page that shows the value of a CCK field "field_foo". I'm trying to sort the table by this field. (I can't use Views for this unfortunately). This is what I have for the header:

$header = array(
  'title' => array('data' => t('Title'), 'field' => 'n.title'),
  'foo' => array('data' => t('Foo'), 'field' => 'n.field_foo', 'sort' => 'desc');
)
$query = db_select('node', 'n')
   ->extend('PagerDefault')
   ->extend('TableSort');
node_build_filter_query($query);

I also tried the name of the field as declared in the $rows, ie...

'foo' => array('data' => t('Foo'), 'field' => 'n.foo', 'sort' => 'desc'); 

This results in a link at the top of the Foo column head, but when I try to click on the link to sort Asc or Desc it doesn't really work and the Foo values aren't ordered in the requested order. If anyone has any suggestions I'd really appreciate it. Thanks!

1 Answer 1

0

Try out Tablesorter moulde and add js function to your js file

$("Table").tablesorter(); 
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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