Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have a node type that references other nodes. When viewing node of Content Type A, I have set up a view that displays all references to nodes of Content Type B on a gmap.

This is the code from a template file that overrides the display of view_one; it calls the map in from another view.

<?php
  $view = views_get_view('view_one');
  $view->set_arguments(array($fields['nid']->raw));
  $view->execute();
  $contents = $view->result;

  foreach($contents as $content) {
    $nodes[] = $content->node_field_data_field_B_content_nid;
  }

  if (isset($nodes)) {
    $args = implode(',' , $nodes);
    $view = views_get_view('linked_map');
    $view->set_display('map');
    $view->set_arguments(array($args));
    $view->execute();

    $markup_map = $view->render($args);

  }
  else {
    $markup_map = '';
  }
?>

It displays beautifully. The only problem is I want to use numbered markers, so that the list is in the same order as the referenced nodes in the main view ("view_one"). Is there some way that I can either utilize a "sort" that won't rearrange the list, or write a custom sort that will preserve the existing order?

I am using the Views module version 7.x-3.1.

share|improve this question
    
what order is it finally being displayed in? –  Jimajamma Apr 4 '12 at 14:44
    
It is displaying by date created I believe, just as a default if I remove all sorting criteria –  user1311807 Apr 6 '12 at 19:23

1 Answer 1

Draggable Views will let you define your own manual sort, and keep it consistent across different displays.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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