Making a field sortable in Views What makes a field sortable in views?

I have 5 fields output in a table and only two (Node Title and an int) are sortable the rest (mixture of content taxonomy and node reference) are not sortable.

Is it possible to add in this functionality via code?
The query_alter function allows build a custom module with the posibility of change sort order of a view. With this function you can add directly to your sql the respective declaration to sort results.

look this guide http://www.adworkshop.com/blog/2011/05/drupal-6-tutorial-exposed-sort-views-2 that show you how to create your query_alter and create the respective html control to your view (in this case is a dropdown menu).

this is the query_alter function:

function example_exposed_sort_views_query_alter(&amp;$view, &amp;$query) {
if( isset( $_GET['sortoptions'] ) ) {
if ( $_GET['sortoptions'] == 'az' )
 $query-&gt;orderby[0] = 'node_title ASC';
else if ( $_GET['sortoptions'] == 'za' )
$query-&gt;orderby[0] = 'node_title DESC'; } }


and this is the example of html control using a dropdown menu using in this case the template views-exposed-form.tpl.php.

&lt;?php
$sortOp = '';
if ( isset($_GET['sortoptions']) ) $sortOp = $_GET['sortoptions'] ;
?&gt;
&lt;label&gt;Sort Name&lt;/label&gt;:
&lt;input type="radio" id="sortoptionsA" name="sortoptions" onchange="javascript:$(this.form).submit();" class="form-submit" value="az" &lt;?php if ($sortOp == 'az') print "checked"; ?&gt; /&gt;A-Z
&lt;input type="radio" id="sortoptionsZ" name="sortoptions" onchange="javascript:$(this.form).submit();" class="form-submit" value="za" &lt;?php if ($sortOp == 'za') print "checked"; ?&gt; /&gt;Z-A