Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#19 | draggableviews-save_order_for_views_3.3-1302188-19.patch | 661 bytes | Matt-H |
#16 | dvview.txt | 35.48 KB | Stan Turyn |
Comments
Comment #1
nirbhasa CreditAttribution: nirbhasa commentedTry the patch in #1264636: Allow for any fieldable entity to be ordered - it worked for me
Comment #2
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedMerged in #1361386: order is not saved, that also has a sample view export.
Comment #3
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedThis is solved for me after updating to the current dev release of DraggableViews and the Views 7.x-3.0 release. Same for you?
Comment #4
TelFiRE CreditAttribution: TelFiRE commentedThis 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?
Comment #5
TelFiRE CreditAttribution: TelFiRE commentedJust 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 :/
Comment #6
ygerasimov CreditAttribution: ygerasimov commented@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.
Comment #7
TelFiRE CreditAttribution: TelFiRE commentedThanks 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
Comment #8
TelFiRE CreditAttribution: TelFiRE commentedWhoops, 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!
Comment #9
winklet CreditAttribution: winklet commentedI 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.
Comment #10
TelFiRE CreditAttribution: TelFiRE commentedWinklet, 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.
Comment #11
justindodge CreditAttribution: justindodge commentedMake 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.
Comment #12
justindodge CreditAttribution: justindodge commentedOops - 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 :)
Comment #13
winklet CreditAttribution: winklet commentedThat 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.
Comment #14
ygerasimov CreditAttribution: ygerasimov commentedI think we can close this issue. Please reopen new one if you have any difficulties.
Comment #16
Stan Turyn CreditAttribution: Stan Turyn commentedI'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.
Comment #17
ygerasimov CreditAttribution: ygerasimov commentedComment #18
mattp52 CreditAttribution: mattp52 commentedSeconding 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:
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.
Comment #19
Matt-H CreditAttribution: Matt-H commentedThe 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():
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.
Comment #20
headkit CreditAttribution: headkit commentedcan't find the codeblock where your patch fits.
Comment #21
Les Lim@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
Comment #22
Jawi CreditAttribution: Jawi commentedwhere ca I find 'draggableviews_views_form_submit' in the module???
Comment #23
iStryker CreditAttribution: iStryker commented@Jawi I don't see 'draggableviews_views_form_submit' either, this is draggableviews_views_submit which
Comment #24
dazz CreditAttribution: dazz commentedI 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.
Comment #25
Jawi CreditAttribution: Jawi commentedI 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"!
Comment #26
seanreloaded CreditAttribution: seanreloaded commentedI 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.
Comment #27
iStryker CreditAttribution: iStryker commentedDraggableviews is working issue free for me.
Comment #28
seanreloaded CreditAttribution: seanreloaded commented1. 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.
Comment #29
iStryker CreditAttribution: iStryker commentedAbout the -3, I've created a new issue to address this. #1780498: Row weights values are all the same.
Comment #30
subspaceeddy CreditAttribution: subspaceeddy commentedHi
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!
Comment #31
iStryker CreditAttribution: iStryker commentedThanks @subspaceeddy. Just want to add, the steps outline in #30 make sense.
Comment #32
heaths1 CreditAttribution: heaths1 commentedI 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.
Comment #33
sylvain_a CreditAttribution: sylvain_a commentedIndeed, '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).
Comment #34
lindsayo CreditAttribution: lindsayo commentedAlso remember to turn off the View caching, a la http://www.elevatedthird.com/blog/draggable-views-caching-drama
Comment #35
ryt CreditAttribution: ryt commentedHi 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
Comment #36
iStryker CreditAttribution: iStryker commentedryt 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.
Comment #37
ryt CreditAttribution: ryt commentedAwesomeness, thank you very much iStryker!
Greatly appreciate it.
Comment #39
big_smile CreditAttribution: big_smile commentedI 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!
Comment #40
woodhous@email.unc.edu CreditAttribution: woodhous@email.unc.edu commentedI 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.
Comment #41
iamEAP CreditAttribution: iamEAP commentedPer #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