- πΊπΈUnited States loze Los Angeles
I've dug into this a bit more and have discovered that the error reported in #19 and #30 are not due to this patch.
This is happening if you have a draggable view with ajax enabled and a views filterTo reproduce:
- Install the latest draggable views (unpatched)
- create a table view page, add the draggable field and enable use ajax
- Add a views filter
- save the view
- visit the view page
- with the js console open, Drag the table and click "save order" (the order is saved successfully)
- change the filter (in my case im just changing the published field from yes to any, so it doesn't actually change the rows results)
- drag the view and click "save order"
- you will see a 404 error in the console.The url the draggable form is calling after you use the filters is /views/ajax, which is returning a 404.
saving the order before using any filters is calling /your-page-url, which saves correctlySee the screenshot of my js console.
Im assuming that this conflict with other ajax forms should be addressed in a separate issue since all this issue is really trying to do is hide the save order submit button and trigger it with javascript.
- πΊπΈUnited States loze Los Angeles
I think this is what is going on here https://www.drupal.org/project/drupal/issues/2994868 π Ajax forms doesn't work properly with ajax views. Active
- πΊπΈUnited States loze Los Angeles
Not sure, but this may be a temporary solution.
https://drupal.stackexchange.com/questions/249891/enabling-ajax-in-views... - Status changed to Needs review
about 2 years ago 3:37am 24 January 2023 - πΊπΈUnited States loze Los Angeles
I think I may have found a workaround. Please try this patch.
- π¨π¦Canada liquidcms
Excite to try out your latest.. but as far as i can tell DVs no longer works (since i have updated from D9.3 to 9.4 since i last looked at this??). I have tried your zip version (without your latest patch) and the clean 2.1.1 version on a simple table view and there is no evidence of a draggable field in the fields list in Views.
- πΊπΈUnited States loze Los Angeles
@liquidcms - this patch is for the latest 2.1.x dev. it allows autosaving with ajax for sortable TABLE views only.
I have tested it both with the latest D9 and D10 and it is working for me, even after other ajax on the view is executed.
The .zip file I posted a few months ago was just showing that I had gotten draggable DIVs (sort of) working. This patch will not apply to it.
I intend to revisit that feature once this and some of the other issues in the queue get committed since some of the patches are stepping on each other. This issue is focusing on getting draggable tables to autosave.
- π¨π¦Canada liquidcms
@loze, no problem that this is only for tables stil; but my comment above was that i can't test any of this as DV doesn't seem to work at all any more. There is no field in the views field list to add. Possibly this is broken in 2.1.1 and i need 2.1-dev. Will check that out.
- πΊπΈUnited States loze Los Angeles
I misunderstood your comment. I thought DV was a typo of DIV, not DraggableView. :)
That is strange. I see it on a clean install. You don't have a "draggableviews" item in the views field category dropdown?
- π¨π¦Canada liquidcms
correct, no Draggable views category for fields. Same view i was testing this with a few months back.
I'll try to test out on current vanilla d9 site (D9.3) and see if any issue upgrading that to D9.4.10.
- π¨π¦Canada liquidcms
@loze, been away from this for a while and just having another look.
so patch in #42 applies to 2.1-dev and is incompatible with your zip above or with the patch in this case: β¨ Support Html List and Unformatted views style plugins. Needs review , correct?
so no progress on having those 2 features working together?
- πΊπΈUnited States loze Los Angeles
The 2 patches probably wont apply together because they both change one or two same lines of code. One needs to be committed first then I can provide a patch for the other feature.
the .Zip was just to show you my manually patched module with both features working together at the time. It's a little outdated by now though, I wouldn't use it.
- π¨π¦Canada liquidcms
The patch in #42 does not fix the issue in #19 for me.
I have only this patch and the one from here: π Undefined draggableviews_structure_parent Closed: duplicate .
I have:
- DV 2.1.2
- set as table with a rendered entity as the only item in the table
- ajax enabledWhen i refresh the page, checkmark to submit is missing. I have draggable widgets to move the rows. When moved i have a message at the top saving unsaved changes. After a while the message is replaced with a message stating order has been saved. Which then fades away.
This view, in the header, has a link which opens a user edit form in a modal:
<div class="col-sm-3"> <a href="/{{ raw_arguments.null_1 }}/user/{{ raw_arguments.null }}/portal-select" class="use-ajax btn btn-primary btn-block" data-dialog-type="modal" > Update list </a> </div>
if i open this and submit, once the modal is closed, i can see the checkmark widget to save DV order has returned. Making a change still shows the message that i have unsaved changes; but it never goes away.
There are no js or php errors.
- πΊπΈUnited States loze Los Angeles
What is the checkmark widget that you are referring to?
- π¨π¦Canada liquidcms
sorry, possibly some css we have. i mean the "save order" button.
Went back to your zip file above. :) it is the closest solution i have seen to what we need.
when other page ajax runs it no longer gets dv js attached, and the save order button shows up again.
removing/changing this: if ($view->ajaxEnabled()) fixes that. The move now triggers the autosave as before i ran the 2nd ajax on the page but event doesnt fire. I can see that the DV save order button no longer has events attached to it. But don't see where button has js events attached to it.
- π¨π¦Canada liquidcms
i may have found my issue. The data-dialog-type="modal" attrs added to A tag as i showed above is not what is loading the modal, i have custom controller code (/user/1/portal-select) that is doing this. I suspect if i simply reload the view on ajax submit of my form, tyhat it will rebuild correctly and work fine.
- πΊπΈUnited States loze Los Angeles
I think we should test if this patch is working for some standard use cases and try to get this feature committed.
It sounds like you have something fairly advanced going on with your view that involves custom ajax controllers. Any number of things could be going wrong there thats not specifically tied to the patch.
It also sounds like you have custom css on your submit button that could be overriding this module hiding the submit button when ajax is enabled.
Hopefully someone else can take a look at this to help move it forward.
- πΈπ°Slovakia coaston
#42 patch resulted to #19 issue in the latest version.
- πΊπΈUnited States loze Los Angeles
My last branch got screwed up this MR35 should work with 2.1.x. Ignore the previous one.
- πΊπΈUnited States loze Los Angeles
Apologies for all the chatter here, but I think I got all the formatting issues resolved. The pipeline checks pass now.
- π©π°Denmark ressa Copenhagen
This would be a great feature. Adding the method in the Issue Summary.
- Status changed to Needs work
about 2 months ago 7:08pm 17 February 2025