Moving http://drupal.org/node/1025128#comment-4244142 here:

I have ported CCK handler. Here is patch that enabled FieldAPI handler and now draggable views can be used with integer weight field. I haven't tested any other functionality.

I have removed ^M symbols in draggableviews.module file.

Patch is against 7.x-1.x branch.

CommentFileSizeAuthor
ygerasimov-fieldapi-handler.patch41.22 KBginc

Comments

ginc’s picture

Status: Needs review » Needs work

Generates this error on edit views page:
Display "Defaults": Draggableviews: You must sort by Fields: field_name_of_integer_weight_field ascending as the first sort criteria to display the structure correctly.

ginc’s picture

error generated by line #77-79 in draggableviews_plugin_style_draggabletable.inc:

      if (strcmp($order_field['table'] . $order_field['field'] . '_value', $sort['table'] . $sort['field']) != 0 || $sort['order'] == 'DESC') {
        $errors[] = t('Display "@display": Draggableviews: You must sort by <i>@group: @title</i> ascending as the first sort criteria to display the structure correctly.', array('@display' => $this->display->display_title, '@group' => $handlers[$this->options['tabledrag_order']['field']]->definition['group'], '@title' => $handlers[$this->options['tabledrag_order']['field']]->definition['title']));
      }
ygerasimov’s picture

Status: Needs work » Needs review

This message is made by design. If you create a draggable view and set up some field as 'order' field, then view should be sorted by this field by default. This is what this message advises.

@GA please advise whether you still have any questions about this?

ginc’s picture

Status: Needs review » Needs work

it gives the error even when u r actually sorting the way required by design.
views: 7.x-3.0-alpha1
references: 7.x-2.x-dev-2011-Feb-25

ygerasimov’s picture

Status: Needs work » Needs review

OK. I have tested again and everything worked without this error.

1. Clean installation of drupal. Clone of draggable views 7.x-1.x. Apply patch above.
2. Add field weight (integer, one value only, text field as widget) to basic page content type
3. Create a view with display page and style draggble table. Fields: title, weight. In draggable table style settings select weight as order field and fieldapi as handler. uncheck "repair broken structures". Add sort criteria by field weight ascendling.
4. Create couple of nodes. Do not assign any weight. Try to sort them on the page with draggable table.

Please view http://www.youtube.com/watch?v=bUxyqrMU_NY

Please confirm you were able to set up everything properly.

dmsmidt’s picture

I tried your approach. With views, & ctools (dev 25 march), draggableviews (dev 25 feb)

First I get a patch error:

patching file draggableviews_handler_fieldapi.inc
can't find file to patch at input line 1316
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/views/draggableviews_plugin_style_draggabletable.inc b/views/draggableviews_plugin_style_draggabletable.inc
|index 6893942..d6dfc0e 100644
|--- a/views/draggableviews_plugin_style_draggabletable.inc
|+++ b/views/draggableviews_plugin_style_draggabletable.inc
--------------------------
File to patch: views/draggableviews_plugin_style_draggabletable.inc
patching file views/draggableviews_plugin_style_draggabletable.inc

Giving the file manually, looks like it works.
Making the view results in this error: Draggableviews: Handler fieldapi could not be found.
When I copied draggableviews_handler_fieldapi.inc to the implementations folder it worked.

The "Show row weights" option doesn't really show the actual weight values though.

So it almost works! Thnx good work so far

Offtopic: Now I tried to make this work for a file type view.. but now I get the Sort error. Removing the sort check from the module gives me a nice view. But it just doesn't want to store the values. (Created this issue: http://drupal.org/node/1104260)

ginc’s picture

i suggest to get this patch to the development branch as it doesn't break anything that worked before (according to my tests), that makes it easier for others to help testing it. what do u think?

ygerasimov’s picture

Status: Needs review » Reviewed & tested by the community

Surely. I will commit this patch to 7.x-1.x-dev then.

ygerasimov’s picture

Status: Reviewed & tested by the community » Fixed

comitted to 7.x-1.x

dboulet’s picture

Status: Fixed » Closed (fixed)

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