Is there a way to reorder nodes, either with just this module or an add-on module? I created a custom content type and added a weight field via this module and created a view of it that sorts by weight. Now I just need a more efficient way to reorder other than editing each node individually and changing the weights, is there a way to do that? Thank you!!

Comments

plato1123 created an issue. See original summary.

nwom’s picture

If your field name is called "Weight" as an example, you'll have a "Weight Selector" field available in views. Add the Weight Selector field as the last field (doesn't have to be exposed). Now you can drag and drop within the view to change the order.

adsequor’s picture

In views I'm reordering rows as desired. Is saving the new order supposed to work ?

adsequor’s picture

Visually reordering nodes in the view works fine but, when I click the saving button, node weights are not changed in database and I still have the initial weights.

ktrev’s picture

I am also facing the same issue. Node weights are not changed in the database.

ziomizar’s picture

Status: Active » Closed (cannot reproduce)

Following #2 with the latest drupal and weight 8.x-3.x it works fine.

If you still have this problem feel free to reopen this issue.

subhojit777’s picture

Status: Closed (cannot reproduce) » Active

Followed #2. The weight is not saved after I click the save button. Tested on Drupal 8.6.4

ziomizar’s picture

Issue tags: +Release blocker

Thanks subhojit777 for reporting this.

That's weird as i wrote some tests to check this behaviour.

Maybe it depend on the machine name of the field, i will check it as soon as i get some time.

ziomizar’s picture

Priority: Normal » Major
ziomizar’s picture

Status: Active » Postponed (maintainer needs more info)

I tried this again on simplytest.me with the rc1 version (same as dev)
- Add a new field `weight` to the basic page content type
- Create a view called `weight` with table format displayed as a page
- Added the field weight_selector to the view
- Removed all the sort criteria from the view
- Added as sort criteria just the `weight` field asc

It save the order correctly.

@subhojit777 do you have a custom configuration or some other modules that can interfere with weight?

subhojit777’s picture

I don't think so. Weird. I followed the exact same steps and the weight did not save.

thihathit’s picture

#10 works but doesn't work for other names. It does have problem with machine name.

ziomizar’s picture

I tried this again on simplytest.me with the rc1 version (same as dev)

- Add a new field `field_random1234` to the basic page content type
- Create a view called `ordered_items` with table format displayed as a page
- Added the field field_random1234_selector to the view
- Removed all the sort criteria from the view
- Added as sort criteria just the `field_random1234` field asc

It still working, so the machine name don't cause this issue.

@thihathit, @subhojit777 could you try with a simple view to see if it works for you?

thihathit’s picture

@ziomizar sorry, turns out I've been using 3.0 instead of rc1. rc1 works properly. Thanks.

ziomizar’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Thanks thihathit,

I will try to release a stable version as soon as the rc1 have enought users to test it.

thihathit’s picture

Cool ziomizar,

Excluding the selector handler field will not save the data even though the draggable icon is still appearing and able to re-order.
If that's not the issue, should there be a note on module page ? that says shouldn't exclude the handler.

ziomizar’s picture

@thihathit that's a very good point.

I've created a follow up in #3025281: Update documentation so we can finally close this issue.

liquidcms’s picture

It sounds like i should be able to get a draggable widget from this field on to a view listing my custom entities. I have tried a couple things:

1. i added a coded field to my entity with the code from comment #8 here: #2887710: weight_selector field missing for custom entity type. In views i then can place the Form Field field to get an integer selector or the basic Weight field which simply displays the integer value.

2. I added a Weight field via the std add Fields UI, but i get this error: There was a problem creating field Weight: The "checkbox" plugin does not exist.

It sounds like there is supposed to be a field_{fieldname}_selector field to add in Views, this does not exist.

this is all in ver 3.4.0

liquidcms’s picture

got it.. even though option 2 (adding field through UI) failed due to checkbox plugin missing; the field was added.. and does work in my view. :)