This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

billyZduke
billyZduke

Not sure what's going wrong here, and there are a few caveats with my configuration that may or may not have had some effect, but here's what I've got:

1) Model list view shows full NestedTree and Re-Order button in form toolbar. The Re-Order modal is coming up with all models listed and allows dragging and dropping of items. At this point I've got over 100 items in the model db table and the tree. HOWEVER, the repositioning of items, particularly top-level items, does not always stick. I've tested making one move at a time before closing/reloading list page, and cannot figure out any consistency to the inconsistencies in behavior that might aid in debugging. Sometimes it's like I never actually made the move I just made, other times multiple Items that I didn't even touch are repositioning themselves... In any case I cannot get things in the order that I actually want them to be with this randomness happening.

2) This model is part of a custom plugin I made with Builder, and when I started out, I was using SimpleTree instead of NestedTree and realized I would need the latter mid-way through population of the db. So I had to do a little code-dancing to make that transition (specifically, populating the nest_left and nest_right columns with ascending integers just to get the whole list of items to appear in the modal to begin with). But considering that re-ordering is indeed possible, sometimes, after the transition, I'm not sure what I could have messed up that would still be having an effect.

3) I need these model items to be able to have multiple parents associated with them, but still wanted the single-parented NestedTree for backend display purposes, so I created a self-reflexive $belongsToMany relationship called "parents," which uses a pivot table where the keys are named and specified as "child_id" and "parent_id." I did not figure the "parent_id" in the pivot would have any chance of getting confused with the "parent_id" in the model, but maybe that has something to do with it?

Last updated

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.