Thanks for the awesome module :)

One question - The current order values are for the entire view, not per parent:
-Parent 1
--Child 2
--Child 3
--Child 4
-Parent 5
--Child 6
--Child 7
--Child 8

Do you know of any way I could generate unique order values per parent, such as:
-Parent 1
--Child 1
--Child 2
--Child 3
-Parent 2
--Child 1
--Child 2
--Child 3

I'd like to use DraggableViews to set priorities and dependencies, but need a way to make things more unique.

Thanks for your insight!

Comments

sevi’s picture

Well, you can calculate the value per parent: child_per_parent = child - parent.
Probably this could be a views field, provided by an optional sub-module of DraggableViews.

I'll look into this shortly.

Greetings,
sevi

brendon’s picture

I would be interested in this as well. Has there been any progress?

sevi’s picture

Not yet.

There's a hook that gets called every time the view is themed.

/**
 * Implementing hook_draggableviews_row_alter.
 */
function [module]_draggableviews_row_alter(&$row, $nid, $info, $view) {
  $column_name = 'title';
  $column = &$row[$column_name];
  $column = '<span class="wrapper-class">'. $column .'</span>';
}

In $info['nodes'] you'll find all calculated values (depth, order, parent,..). With these values you can calculate the special-order-values you need.

It may be useful to provide a hook that gets called every time the hierarchy was built. So the values you need can be calculated and saved to the database (in pairs {nid, special-order-value}) before the view gets executed.

Another idea:
Would you need the structure to be valid even if the view gets only executed (and not rendered)?

Greetings,
sevi

sevi’s picture

Status: Active » Closed (fixed)

I created a new module for stuff like this.
If needed re-create this issue at DraggableViews Navigator.

Greetings,
sevi