Index: flexinode/flexinode.module
===================================================================
--- flexinode.orig/flexinode.module	2005-10-31 19:07:01.000000000 +1100
+++ flexinode/flexinode.module	2005-10-31 22:17:48.062489442 +1100
@@ -280,6 +280,9 @@
     }
   }
 
+  // record the sort column name
+  if (isset($_GET['order'])) $sort_name = $_GET['order'];
+
   // Build the columns.
   $header[] = array('data' => t('title'), 'field' => 'n.title');
   foreach ($ctype->fields as $field) {
@@ -294,9 +297,15 @@
         $header[] = array('data' => t($field->label));
       }
     }
+    // when the field is not in the table, manual sort is necessary
+    else if (isset($sort_name) && !isset($hidden_sort_column) && t($field->label) == $sort_name) {
+      $hidden_sort_column = flexinode_invoke('db_sort_column', $field);
+    }
   }
 
-  $sql .= tablesort_sql($header);
+  if (isset($hidden_sort_column)) $hidden_sort_column .= ', ';
+
+  $sql .= tablesort_sql($header, $hidden_sort_column);
 
   // Build the rows.
   $rows = array();
