POS在Trello API中实际上意味着什么 [英] What does the POS actually mean in the Trello API

查看:121
本文介绍了POS在Trello API中实际上意味着什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用dillenmeisters Trello.Net API包装器,并且在每个Card上都有一个POS属性.我以为这是在列表中的位置,但是数字似乎是任意的,范围从4到5位数字.无论如何,有没有足够的意义来将新的Card放置"在列表中已经存在的另外2个之间?

I'm using dillenmeisters Trello.Net API Wrapper, and on each Card it has a POS attribute. I thought that was for position in the list that it was in, but the numbers seem arbitrary, ranging from 4 to 5 digit numbers. Is there anyway to make sense of these enough to "place" a new Card between 2 others that already exist in the list?

推荐答案

在Trello.NET的0.5.9-beta1版本中(在NuGet上可用):

Available in version 0.5.9-beta1 of Trello.NET (on NuGet):

// Ways to set the position of a card
trello.Cards.ChangePos(card, 1234)
trello.Cards.ChangePos(card, Position.Top)
trello.Cards.ChangePos(card, Position.Bottom)

我还没有深入研究过pos的工作原理,但是我认为这是一个排序顺序.如果要在其他两张卡之间移动一张卡,则可以获取这两张卡的位置,并将它们的Pos相加并除以二.

I haven't dug deeply into how pos works, but I think it's a sort order. If you want to move a card between two other cards, you could get the position of those two cards and add their Pos together and divide by two.

例如,如果要在卡A和卡B之间插入卡C:

For example, if you want to insert Card C between Card A and Card B:

  1. 卡A-位置16
  2. 卡B-位置32
  3. 卡C-Pos 64

(16 + 32)/2 = 24. 将Card C Pos设置为24.

(16 + 32) / 2 = 24. Set Card C Pos to 24.

  1. 卡A-位置16
  2. 卡C-Pos 24
  3. 卡B-Pos 32

我认为他们这样做是为了使他们仅需在移动卡时更新一个Pos(而不是此后所有卡的Pos,如果他们使用无间隙的连续Pos,则有必要).

I think they do this so that they only have to update ONE Pos when a card is moved (instead of the Pos of all cards after it which would be necessary if they used a sequential Pos with no gaps).

这篇关于POS在Trello API中实际上意味着什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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