如何像 Trello 一样重新排列卡片和列表? [英] How to rearrange cards and lists like Trello?

查看:48
本文介绍了如何像 Trello 一样重新排列卡片和列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试重新排列卡片,例如 Trello 列表.

我在这里读到它是如何做的如何Trello 处理卡片、列表、清单等的重新排列 和这里 POS 在 Trello API 中的实际含义是什么

每个位置以值 65,535 开始,并创建一个新的卡片或列表,其中最后一个位置 + 65,535,例如:

卡片列表

{ "_id" : ObjectId("5e7ea117e13673ec0db43104"), "name" : "A", "position" : 65.535 }{_id":ObjectId(5e7ea117e13673ec0db43105"),名称":B",位置":131.071}{_id":ObjectId(5e7ea117e13673ec0db43106"),名称":C",位置":196.607}{_id":ObjectId(5e7ea117e13673ec0db43107"),名称":D",位置":262.143}{_id":ObjectId(5e7ea117e13673ec0db43108"),名称":E",位置":327.679}

如果卡片 E 插在卡片 A 的顶部,它将被除以 2 (65,535/2 = 32,767)

如果卡 A 插在卡 E 的底部,则加起来为 65,535 (327,679 + 65,535 = 393,214)

中间,两个相邻位置的位置平均值.

问题是,如何将任何位置更改为倒数第二个位置?D和E之间?还是在A和B之间?

如果卡A插在卡D和E之间,或者卡E插在A和B之间,这是什么逻辑?

有没有更好的方法来做到这一点?

解决方案

您也可以使用 Lexorank 算法.这就是 Jira 处理卡片订购的方式 https://www.youtube.com/watch?v=OjQv9xMoFbg&feature=youtu.be

您可以在 GitHub 中找到 Lexorank 的多个实现.下面是 Lexorank https://github.com/acadea/lexorank>

I'm trying to create a rearrangement of cards, lists like Trello.

I read about how it does here How does Trello handle rearrangement of cards, lists, checklists etc and here What does the POS actually mean in the Trello API

Each position starts with the value 65,535 and creates a new card or list with the last position + 65,535, for example:

Card List

{ "_id" : ObjectId("5e7ea117e13673ec0db43104"), "name" : "A", "position" : 65.535 }
{ "_id" : ObjectId("5e7ea117e13673ec0db43105"), "name" : "B", "position" : 131.071 }
{ "_id" : ObjectId("5e7ea117e13673ec0db43106"), "name" : "C", "position" : 196.607 }
{ "_id" : ObjectId("5e7ea117e13673ec0db43107"), "name" : "D", "position" : 262.143 }
{ "_id" : ObjectId("5e7ea117e13673ec0db43108"), "name" : "E", "position" : 327.679 }

If Card E is inserted at the top of Card A, it will be divided by 2 (65,535 / 2 = 32,767)

If Card A is inserted at bottom of Card E, it adds up to the value of 65,535 (327,679 + 65,535 = 393,214)

In the middle, the position average of two adjacent positions.

The problem is, how can I change any position to the penultimate position? between D and E? Or between A and B?

If card A is inserted between cards D and E, Or insert Card E between A and B what logic is it to do this?

Is there a better way to do this?

解决方案

You could also use Lexorank algorithm. That's how Jira is handling their ordering of cards https://www.youtube.com/watch?v=OjQv9xMoFbg&feature=youtu.be

You can find multiple implementations of Lexorank in GitHub. Here's for example one simple JavaScript implementation of Lexorank https://github.com/acadea/lexorank

这篇关于如何像 Trello 一样重新排列卡片和列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆