Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于$grid->order->orderable();的文档建议 #2138

Open
cirvor opened this issue Oct 9, 2024 · 0 comments
Open

关于$grid->order->orderable();的文档建议 #2138

cirvor opened this issue Oct 9, 2024 · 0 comments

Comments

@cirvor
Copy link

cirvor commented Oct 9, 2024

  • Laravel Version: 9.52.16
  • PHP Version: 8.2.23
  • Dcat Admin Version: 2.2.3-beta

Description:

遇到的问题是,在已有数据的情况下新增排序功能 效果如下:
1728444143767

若此时order字段为后续新增,默认值自然为0,此时点击排序后不会报错,也不会更新数据库中的排序权重
这是因为排序功能的实现是按照:“与上面一位的权重值进行交换”
若都为0,则始终都不会更新权重

修复的办法:
要么手动删除现有数据重新添加,'sort_when_creating' => true,会自动递增权重值
要么手动在数据库中把order字段从1开始填写上去

因此,在这儿建议一下在文档中说明此状况,免得后续再有人踩坑😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant