Short question: Can you sort alphabetically by Node: Title when using a View set to a Table?
My search for answers so far have led to a dead end.
Long explanation:
I'm reaching a point where a site I've been developing is going to go from staging to live and am having problems sorting a View by Node:Title
Although I'm reluctant to post a link to the staging site, I'd love to find a solution, so here's the link:-
http://swedenborg.gencon.co.uk/library/a-general-manuscripts
(Please note, this link may become irrelevant as an example in a day or so)
The items in the library section are all imported content, with the exception of the last two.
Take a look at the very last page - these last are two items are created using my library content type - aaaa & Test.
In other words, any new items added to this content type are not sorted alphabetically.
No matter what I try, the Title will not sort alphabetically.
(I am aware that some Titles have preceeding spaces or inverted commas, this isn't the issue)
In hindsight, I should have created a custom field for the Library titles - too late now, as there's about 4300 of them!
My intermediate solution is to sort by the Shelf Number, as this is a custom field.
Here's the view export:-
$view = new stdClass();
$view->name = 'library_a';
$view->description = 'The Archives, A - General Manuscripts';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'The Archives, A - General Manuscripts';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = 'No content';
$view->page_empty_format = '1';
$view->page_type = 'table';
$view->url = 'library/a-general-manuscripts';
$view->use_pager = TRUE;
$view->nodes_per_page = '30';
$view->sort = array (
array (
'tablename' => 'node',
'field' => 'title',
'sortorder' => 'ASC',
'options' => '',
),
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'node_data_field_lib_shelf_number',
'field' => 'field_lib_shelf_number_value',
'label' => 'Shelf Number',
'handler' => 'content_views_field_handler_group',
'sortable' => '1',
'defaultsort' => 'ASC',
'options' => 'default',
),
array (
'tablename' => 'node',
'field' => 'title',
'label' => 'Title',
'handler' => 'views_handler_field_nodelink',
'sortable' => '1',
'options' => 'link',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'library',
),
),
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'term_node_2',
'field' => 'tid',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => '34',
),
),
);
$view->exposed_filter = array (
array (
'tablename' => 'term_node_2',
'field' => 'tid',
'label' => 'Category',
'optional' => '0',
'is_default' => '0',
'operator' => '1',
'single' => '0',
),
);
$view->requires = array(node, node_data_field_lib_shelf_number, term_node_2);
$views[$view->name] = $view;
Comments
The views was sorting
The views was sorting fine for me with an alphabetical menu until i upgraded to the version 5.7 of Drupal and the latest views.
www.iofilm.co.uk - Not a Drupal site yet!
Sorting problemo sorted
I discovered a solution to the problem at this thread: http://drupal.org/node/185518
The alphas module also has a facility for filtering common words like A, the, and An, etc.
I had to remove the existing argument I had that was working but that was all to get it working.
www.iofilm.co.uk - Not a Drupal site yet!