Closed Backoo closed 5 years ago
Hi @Backoo, there are some anomalies with your second list. It's also be helpful to have a primary id in each table example so we can track between the two examples.
Your second list as a row: 1, 36, 5. It was 1, 37, 5 initially. Is that just a typo.
Given your acts_as_list
line I would expect that all of the example rows would have a position of 1 because they're all in different scopes. I think you might have things misconfigured in some way. Also :bottom
is the default for add_new_at
.
Let me know how you get on.
Hi @brendon, you are right. I was wrong in showing column data and I (subtly :scream:) misconfigured the :scope
option. Now all works and I updated the issue for clarity.
You may want to close the issue.
Thanks for reporting back @Backoo :D It's always good to hear when people manage to solve the problem. Feel free to put your solution here for others if they come across this. Also, be sure to tidy up the Stack Overflow question/answer for other users :)
_I'm not sure if my issue is related to this one or already been solved, so I try to post it here._ :bowtie:
I'm using acts_as_list v0.9.17 this way:
When a new (scoped)
@list_item
is created, say the one wherecolumn1_id
is1
,column2_id
is11
andcolumn3_id
is37
, the database looks as follows, as expected:However, when a
@list_item
is destroyed, say the one wherecolumn1_id
is1
,column2_id
is11
andcolumn3_id
is56
(record id751
), then the database looks as follows:That means there is a gap for
position
2
.How to prevent or adjust the gap? That is, how to handle reordering of list items when a list item is destroyed?
Note: I know there are methods that change position and reorder list but I don't know whether and how to use them to solve the issue (maybe using someway
remove_from_list
).