I'm having a problem getting the draggable table order to save.
I create a draggable table view. If I drag the rows around and press save the order does not save and the table returns to the way it was before I made changes.
I'm using a field with relationships and an argument in the view.
I have tried various different configuration settings on the table and have not been able to get this to work.
Seems like this might be bug.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nirbhasa’s picture

Try the patch in #1264636: Allow for any fieldable entity to be ordered - it worked for me

Niklas Fiekas’s picture

Merged in #1361386: order is not saved, that also has a sample view export.

Niklas Fiekas’s picture

This is solved for me after updating to the current dev release of DraggableViews and the Views 7.x-3.0 release. Same for you?

TelFiRE’s picture

This is not solved using either 7.x-2.0-beta1 or 7.x-2.x-dev on Views 7.x-3.3. If you can't save the order what's the point of the module?

TelFiRE’s picture

Priority: Normal » Critical

Just think this should be critical because the module is entirely unusable and worthless without this fixed. I think this is a really cool concept and like how it's supposed to work, but I just wasted hours configuring it only to find out that the most up to date versions do not work out of the box :/

ygerasimov’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Priority: Critical » Normal

@TelFiRE, lets move this issue to 2.x branch as you say it doesn't work there.

Could you please provide instructions how to create a view (as I understand with relation) that doesn't work? Maybe you can export your view here so I can review it and try to figure out where is the bug.

TelFiRE’s picture

Thanks for following up. I can't really figure out any settings that will make it work, it's more of an out of the box thing. That said, I'll install it to a completely and totally clean module and theme-free D7 core tomorrow and see if it still occurs and get back with you. Thanks again

TelFiRE’s picture

Whoops, when I did the example my problem was that I had not added the filter criteria. I was positive I had done this on the live one, but when I went back it turns out it was underneath another filter that was taking precedence. Sorry about that!

winklet’s picture

I am having this exact problem and I can't figure it out. I am NOT a technical person and only have a very basic understanding of PHP and JS, and have been struggling with Drupal for weeks now. Can anyone help me using simple terms and a step by step explanation (like for dummies)? I tried applying the patch (on windows using Tortoise SVN) but it wouldn't apply it at all.

FYI what I want to do is display images with descriptions on a page shown in rows/columns. I can get the views to display this properly but I would really like is to be able to drag and drop to sort them in whatever order I want.

TelFiRE’s picture

Winklet, for me, the issue was as simple as re-arranging the filters. It was filtering by post date first, then by weight, but it needed to be the other way around.

justindodge’s picture

Make sure you add the "Draggableviews: Weight" field to the sort criteria of the view - I don't think this is listed in the instructions and it had me stuck for a minute.

justindodge’s picture

Oops - the sort criteria thing is totally in the instructions, I must have just skimmed over it. My bad! To others having issues, this might still be a good reminder :)

winklet’s picture

That did help, however I then encountered other problems, so for now I am abandoning it. For one thing, it created duplicates of some of the entries. Also, I'm working on a multilingual site and I had trouble getting the sorting to apply to all languages.

ygerasimov’s picture

Status: Active » Fixed

I think we can close this issue. Please reopen new one if you have any difficulties.

Status: Fixed » Closed (fixed)

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

Stan Turyn’s picture

FileSize
35.48 KB

I'm having this issue too. Tried both release and dev versions as well as changing the view properties - nothing helps. "Draggable views: weight" is the only sort criterion. I am attaching my view export in the hope that someone kindly takes a look and tells me where I am going wrong.

ygerasimov’s picture

Status: Closed (fixed) » Active
mattp52’s picture

Seconding this - have tried creating a set/display pair of views as displays in the same view and as two separate views. Have tried creating a view from scratch so the 'setting' view is the default. Best I can tell, the problem is that the SQL query generated for the display version of the view includes a join condition that specifies the display ID of the view showing the order rather than the one setting it. This results in all the weight values being NULL in the results so a different order.

I assume the intended behaviour should either be to:

  • Generate rank rows in the draggableviews_structure table for every display tied to a draggable source (i.e. generate multiple rows on reorder) or,
  • Resolve the Display ID of the source view from which the order is resolved, instead of selecting the display ID of the view being displayed

Would be good to know what the intended behaviour is here? As a sidenote, this issue is observed with all views set to not cache, with views caching disabled and as the logged in default admin user.

Matt-H’s picture

Status: Active » Needs review
FileSize
661 bytes

The reason the row order isn't getting saved is because the hook function hook_views_form_submit() no longer exists with Views 3.3, and the 7.x-2.x-dev version of Draggableviews tries to save the weight records using an implementation that hook.

The solution is to assign that function to the submit handler using hook_form_alter():

function draggableviews_form_alter(&$form, &$form_state, $form_id) {
  if (isset($form['draggableviews']) && !empty($form['draggableviews'])) {
    $label = $form['view']['#value']->field['draggableviews']->options['draggableviews']['save_button_label'];
    $form['actions']['submit']['#value'] = t($label);
+   $form['actions']['submit']['#submit'][] = 'draggableviews_views_form_submit';
  }
}

The 7.x-2.0 version of Draggableviews seems to already do something like this, assigning the 'draggableviews_views_submit' function into the '#submit' array.

headkit’s picture

Priority: Normal » Critical

can't find the codeblock where your patch fits.

Les Lim’s picture

Status: Needs review » Active

@Matt-H: not sure, but I think your 7.x-2.x-dev is obsolete. Both the latest dev and 2.0 have already resolved this. Here's that issue:

#1477132: Stop using hook_views_form_submit(), move code to a proper submit callback

Jawi’s picture

where ca I find 'draggableviews_views_form_submit' in the module???

iStryker’s picture

@Jawi I don't see 'draggableviews_views_form_submit' either, this is draggableviews_views_submit which

Save weight records after form submit.
dazz’s picture

I fixed the problem by NOT excluding the Draggableviews: Content field from display. The weight in the form_state array was always 0 when the field was excluded.

Jawi’s picture

I can't confirm this.

Including this field doesn't doesn't fix the problem that the output of the values that is send by ajax is not saved.

So everything is working fine - and changing the order also changes the numbers of the draggable field.

BUT:"The output is not saved"!

seanreloaded’s picture

I concur with Jawi; I'm getting the same issue. Changing the order also changes the numbers of the row weights, but does not save changes when the Save button is clicked. Instead, weights revert back to their previous states.

iStryker’s picture

Draggableviews is working issue free for me.

  1. Are you using the latest dev verison or 2.0?
  2. Do you have any exposed filters, in either the rearrange or the display view?
  3. Are you using a table view? If so do you have a default sort? What is it?
  4. Check draggableviews_structure table in the database, are the weights being save correctly?
    • If you don't have access to the database, apply #1719198: Create 'weight' field for views patch
    • Add new weight field to the view you are having trouble with (rearrange and/or display).
    • Are all your weight 0 or do you have 0-X?
seanreloaded’s picture

1. I'm using 7.x-2.x-dev
2. No exposed filters.
3. It looks like the weights aren't even being saved into the draggableviews_structure table.

Regardless of what I set the row weights to, they all revert back to -3.

iStryker’s picture

About the -3, I've created a new issue to address this. #1780498: Row weights values are all the same.

subspaceeddy’s picture

Hi

I ran into this problem and found a solution for me. I have the same issues as mattp52 above
Steps to reproduce of problem:
1. Create a view that lists Content - default page created (machine name 'page')
-- remove default Sort Criteria 'Content:Post date (desc) -- Apply (all displays)
2. Add a Page that will become the Draggable View Sorting Page (machine page 'page_1')
-- set Display name as DV1
-- Format -- This page (override) display format 'Table' -- Apply (this display)
-- add Field 'Draggable Views:content', (override) leave handler as 'Native' -- Apply (this display)
-- add Path 'dv1'
3. Go back to 'page'
-- add Sort Criteria 'Draggableviews: Weight' -- Apply (all displays)
4. Add another Node List page (machine name page_2)
-- give it some arbitrary path name
5. Add another page that should become the sort page for the second list page (page_2) -- (machine name 'page_3')
-- set Display name as DV2
-- Format -- This page (override) display format 'Table' -- Apply (this display)
-- add Field 'Draggable Views:content', (override) leave handler as 'Native' -- Apply (this display)
-- add Path 'dv2'

-- click through the Views here - all the Joins are "AND draggableviews_structure.view_display = 'page_1'"

6. Save the view (so that the draggable views created are available to be chosen)
7. Edit the View.
8. Go to Page machine name 'page'
-- Edit 'Draggableviews: Weight' - set 'Display sort as' to (DV1)
-- Apply (all displays)
9. Go to Page machine name 'page_2'
-- Edit 'Draggableviews: Weight' - (override) set 'Display sort as' to (DV2)
-- Apply (this display)

-- click through the Views here - all the Joins for 'page', 'page_1', and 'page_2' are correct ('page_1', 'page_1' and 'page_3' respectively), however DV2 ('page_4) is still pointing at 'page_1' - any sorting using this draggable view will result in 'draggableviews_structure_weight' being NULL.

Trying to rectify this by clicking on Sort Criteria 'Draggableviews: Weight' is impossible - the 'Display sort as' option is hidden on Draggableview edit View pages. (draggableviews_handler_sort.inc, method 'options_form', around line 88-95 hides the form element and sets defaults. Unfortunately these defaults have been already set using 'Apply (all displays)' on an incompatible View page, and so do not get set to the Draggableview page being edited).

The remedy (work around) is to remove (override) Draggableviews: Weight Sort Criteria from DV2 and add it again using 'Apply (this display)' .

Lesson: Don't use Apply (all displays) on Sort Criteria 'Draggableviews: Weight' …

Hope this helps someone because it took ages to track down. I don't have the time to write a fix right now though!

iStryker’s picture

Thanks @subspaceeddy. Just want to add, the steps outline in #30 make sense.

heaths1’s picture

I did have the same issue, and found the same fix that dazz stated in #24 worked for me. Excluding Draggable Views: Content leaves the entries draggable, but nothing gets saved. The table reverts to the original order. Unchecking the box on excluding this field fixes this potential issue.

sylvain_a’s picture

Indeed, 'Display sort as' is not available on other displays, besides the default display.
Luckily, i got around it by making it active on all displays, except the sorter, instead of using the override (for this display only).

lindsayo’s picture

Also remember to turn off the View caching, a la http://www.elevatedthird.com/blog/draggable-views-caching-drama

ryt’s picture

Version: 7.x-2.x-dev » 7.x-2.0

Hi All,

Getting the same issue. DraggTable working but not saving.
I've spent this whole week-end on the issue. Tried every tip I found on the internet except patching the code (not comfortable doing this).

Are there any plans for realising a new version of this module soon?
I am not in the capacity to help with code but would like to contribute & test if this helps.

Many thanks

iStryker’s picture

Title: Draggable Table Not Saving Order » Draggable Table Not Saving Order in 7.x-2.0
Version: 7.x-2.0 » 7.x-2.x-dev
Status: Active » Fixed

ryt the roadmap to 7.x-2.1 was released yesterday. #1913130: META: Plan for Draggable Views 7.x-2.1 release. You can find a link on the project homepage (for now). Help fix draggableviews issues to get 7.x-2.1 release quicker.

Draggableviews table is now saving in 7-x-2.x-dev. This issue is getting closed.

If you are still having trouble with 7.x-2.x-dev, open a new issue.

ryt’s picture

Awesomeness, thank you very much iStryker!
Greatly appreciate it.

Status: Fixed » Closed (fixed)

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

big_smile’s picture

I have updated to the dev version of this module and run 'update.php' and cleaned the cache, but I cannot get draggable Views to save.

What steps can I take to trouble shoot the issue - I am not sure where to start!

woodhous@email.unc.edu’s picture

I have Drupal 7.22, Views 7.x.3.7 and Draggableviews 7.x.2.0. I have also tried Dragableviews 7.x-2.x-dev. The Draggableviews has been broken for a very long time. It was working when I was working on my sites in Aug 2012 and for a while after that. I don't know exactly when it broke but it happened during some updates I'm sure. I have been searching and searching and following the threads and none of the "work-arounds" solve the problem. My views are setup correctly. I've tried many combinations. It should be easy to reproduce. I have a sort order view for ordering the items. I have other views that depend on that sort order. It is very straight forward and like I said it was working before. The weights in the table are correct. This is an urgent issue. There's no point to Draggableviews if this isn't fixed.

iamEAP’s picture

Per #36, I've opened a new, related issue (which you may be experiencing) over here: #2176097: In-place sorting will not save sort order when Views render cache is used