nova-sortable icon indicating copy to clipboard operation
nova-sortable copied to clipboard

Weird index position

Open petrenkorf opened this issue 5 years ago • 5 comments

I have a table with less than 100 records and the position column as NULL. When I sort any record, it updates the position of all records on that page, but the index starts at 11000. Is it the expected behaviour? Because, since the other records position are NULL, they are shown first after the page refresh.

petrenkorf avatar Sep 19 '19 14:09 petrenkorf

https://github.com/ofcold/nova-sortable/blob/master/resources/js/components/ResourceTable.vue#L159

What is gained by offsetting the index by 11000?

This offset has caused a bug in our application. When sorting, it only sorts for all the items on the current page. I have 25 items on a page ie. 1 .... 25 26 27 28 I sort one of the items everything is out of order ie. 26 27 28 11000 ... 11025

I am not seeing how a sort works differently for 11k vs any other number. The issue I have is that, while you have a function to define the DB column to use, there is no callback function to overwrite this offset. For me resolve this bug, I will need to improvise a bit with a function that interjects in the lifecycle of the request to manage this value. I just may fork this repo. I am just pointing out that there is no value gained from 11k vs 1, but it has the huge downside of it not being intuitive.

jedlynch avatar Oct 01 '19 19:10 jedlynch

Share a secret why exactly 11000 is used? Why not 1?

webspilka avatar Oct 22 '19 12:10 webspilka

This is a matter of personal habits, and this number has no meaning. Are there any advantages to starting from 1?

lilianjin avatar Feb 21 '20 16:02 lilianjin

@jedlynch pointed the issue.

petrenkorf avatar Mar 06 '20 02:03 petrenkorf

Hey @lilianjin, could you please publish a new version of your package (at Packagist) with the changes. Then we don't have to use the dev-master build. Also I think this Issue can be closed?

JustBronkoDE avatar Apr 08 '20 10:04 JustBronkoDE