multiple displays in the same view breaks draggableviews

brian42 - February 24, 2009 - 19:29
Project:DraggableViews
Version:6.x-3.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Currently, there can be multiple draggableviews on the same page. However, this can only be achieved if each of the draggableviews resides as a display in a distinct view. That is to say, creating a single view and adding two panel displays with a style of draggable table will result in the same problem as before (the first draggableview to load will work but the second will break both).

This appears to be because the patch that was added uses the view name to generate the form_id. Changing it to a counter or if there is some way to reference a unique views display should fix the issue.

#1

brian42 - February 24, 2009 - 20:48

After playing around a little I found a solution that works for me without using a counter.

draggableviews_plugin_style_draggabletable.inc

function render() {
  return drupal_get_form('draggableviews_view_draggabletable_form_'. $this->view->vid . '_' . $this->view->current_display, $this);
}

draggableviews.module

// register theme function for all views
$views = views_get_all_views();
foreach ($views AS $view) {
  if (!isset($view->disabled) || $view->disabled === FALSE) {
    foreach (array_keys($view->display) As $id) {
      $array['draggableviews_view_draggabletable_form_'. $view->vid . '_'. $id] = array(
        'template' => 'draggableviews-view-draggabletable-form',
'preprocess functions' => array(
  'template_preprocess_draggableviews_view_draggabletable_form',
),
'arguments' => array('form' => NULL),
      );
    }
  }
}

#2

sevi - March 5, 2009 - 23:00

Ahh, ok. I didn't test it with multiple displays. Many thanks. The next development snapshot will contain this change.

#3

Straddle - March 7, 2009 - 06:50

Any ETA on the next snapshot? :)

#4

sevi - March 8, 2009 - 14:51

I committed the latest changes 5 minutes ago :)

#5

sevi - March 31, 2009 - 21:40
Status:active» fixed

Seems to be fixed

#6

System Message - April 14, 2009 - 21:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#7

realityloop - June 19, 2009 - 02:33
Status:closed» needs work

This is still not possible if you use a CCK field as the Draggable View sort field, which is the only way to sort another view containing the same nodes.

I hope my explaination makes sense, if not ask me for further information.

The view displays but ordering isn't possible, and I always get status message "The structure was broken. It has been repaired."

#8

careernerd - July 6, 2009 - 19:37
Status:needs work» needs review

Here's a Patch that fixes this problem, this happens even when multiple displays are not shown on the same page.

It sets the form ID/theme function to always include the $view->name and $view->current_display.

Using the VID isn't necessary because view->name is unique.

AttachmentSize
draggableviews-382678.patch 2.17 KB

#9

sevi - July 9, 2009 - 20:53

Thanks for the patch; Committed to DRUPAL-6--3 branch.

Greetings,
sevi

#10

sevi - August 15, 2009 - 17:34
Status:needs review» fixed

Guess this is fixed.

#11

System Message - August 29, 2009 - 17:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.