I have made a view for my front page. I am allowing 4 nodes in FULL VIEW mode. I want to sort them by node ID (lowest ID at top, highest at bottom), but instead it sorts in some unknown fashion. I have unpromoted and promoted the nodes figuring it may be that I needed to make the view first, then promote the nodes with the sort criteria already set. No go. I changed the sort from ascending to descending and back again (always unpromoting first then promoting the nodes after changing the view) to see if that changed the sort order. It did not. I promoted the nodes in ascending and descending node ID order to see what would happen, but ALWAYS the nodes sorted with no regard to node ID, at least that I can see.

Right now they are sorted on the page with the highest node ID at the top and the lowest at the bottom. This being the case whether I have the sort criteria set to ascending or descending and whether I promoted the nodes in ascending or descending order. I am completely out of ideas here. Am I missing something? Is there a trick to sorting by node ID that I should know about?

Comments

kgriffin’s picture

Title: Problem with sort by Node ID » Problem with sort by Node ID: VIEW EXPORT

VIEW EXPORT

$view = new stdClass();
$view->name = 'homepage';
$view->description = 'The basic front page view.';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'Welcome!';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'node';
$view->url = '';
$view->use_pager = TRUE;
$view->nodes_per_page = '4';
$view->sort = array (
array (
'tablename' => 'node',
'field' => 'nid',
'sortorder' => 'ASC',
'options' => '',
),
);
$view->argument = array (
);
$view->field = array (
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'promote',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
);
$view->exposed_filter = array (
);
$view->requires = array(node);
$views[$view->name] = $view;

kgriffin’s picture

Title: Problem with sort by Node ID: VIEW EXPORT » Problem with sort by Node ID
kgriffin’s picture

Version: 5.x-1.x-dev » 5.x-1.5
sun’s picture

Status: Active » Closed (won't fix)

Sorry, unfortunately this support request is way too specific. Please have a look at the issue queue - Views maintainers are buried already. You might want to try to get further support at http://drupal.org/support.

groberts100’s picture

Same problem here. I don't want to sound ungrateful (because I have not contributed anything to Drupal) but isn't getting the sort order working quite important ?

For me it means that my news page doesn't show news articles in any sensible order. Which from the users point of view is pretty poor.

I think this is quite important.

I will have a quick look myself but I am more Java and Rails than PHP.

Curious Stu’s picture

Version: 5.x-1.5 » 6.x-2.0

I am having the exact same problem trying to sort ascending by node id. Not only is this important, it is an imperative resource that the client demands. Having the facility and option within Views is one thing, but then actually doing what is requested is another. There is nothing "way too specific" about this as it has many different applicable uses.

It is still broken in 6.x. Why offer it in the views module if it won't do what it's supposed to?

It seems to me that the only way to get the views to display what you want is not to use views and simply create the queries in an exterior hack and bypass the Drupal system completely. Do these modules get tested in the real world by anyone who uses them to exhaustion, instead of simply checking that the code fits in with the Drupal model?

Start the flames...

UPDATE

Many thanks to Mike at Computer Minds for the answer to this quandary. For those who don't know (it's not obvious at all), if you have 'table' set as the style, the settings for that option need to state 'none'. Otherwise it totally ignores your request.

There should probably be an option to remove the sorting facility from the styles section or simply remove the sort facility if table is selected as this is horrendously frustrating for the end user who is not 100% familiar with the Views module.

Anyway, all sorted now.