Class: List

TrelloEntities.List(data)

The List class represents a List in Trello.

You will mostly deal with lists in IterableCollections returned from Board methods.

Constructor

new List(data)

Parameters:
Name Type Description
data

(Object} key/value pairs of information, must at least contain "id", can basically just pass in response from Trello API

Source:
Examples
new Trellinator().board("Some board").findOrCreateList("ToDo");
new Trellinator().board("Some board").list("ToDo").cards().first().postComment("Me first!");
new Trellinator().board("Some Board").lists().each(function(list)
{
    list.cards().first().postComment("Me first!");
});

Methods

(static) this.archive()

Archive this list

Source:
Example
card.currentList().archive();

(static) this.board()

Return the board that contains this list

Source:
Example
card.currentList().board();

(static) this.card(name)

Return a Card from this list, filtered by name or regex

Parameters:
Name Type Description
name string | RegExp

a string or RegEx to match against the name of the cards, if multiple match the first will be returned

Source:
Examples
card.currentList().card("Another Card");
card.currentList().card(new RegExp("Process.*"));

(static) this.cards(name)

Return an IterableCollection of cards in this list, optionally filtered by name using a string or regex

Parameters:
Name Type Description
name string | RegExp

a string or regex to match against the names of cards in this list

Source:
Example
card.currentList().cards(new RegExp(card.name()+".*")).each(function(loop)
{
    if(loop.id() != card.id())
        loop.postComment("Twinsies!");
});

(static) this.copy()

Copy this list

Source:
Example
var notif = new Notification(posted);
notif.board().copy();

(static) this.countCards()

Return the number of cards in this list

Source:
Example
card.currentList().countCards();

(static) this.id()

Return the id of this List

Source:
Example
board.list("Some List").id();

(static) this.isBoard()

Is this link a board?

Source:
Example
card.currentList().archive();

(static) this.isCard()

Is this link a trello board?

Source:
Example
card.currentList().archive();

All attachments in Trello are links

Source:
Example
card.currentList().archive();

(static) this.move(board)

Move a list to a different board

Parameters:
Name Type Description
board Board

the board to move this list to

Source:
Example
var to_board = new Trellinator().board("Some Board");
new Notification(posted).addedCard().currentList().move(to_board);

(static) this.moveAllCards(to_list)

Move all cards from this list to another

Parameters:
Name Type Description
to_list List

a List object to move all cards to

Source:
Example
var notif = new Notification(posted);
var from_list = notif.board().list("Start");
var to_list = new Trellinator().board("Another").list("Finish");
from_list.moveAllCards(to_list);

(static) this.name()

Return the name of this List

Source:
Example
card.currentList().name();

(static) this.position()

Return the current position of this list

Source:
Example
new Notification(notification).addedCard().currentList().position();

(static) this.setName()

Set a new name for this list

Source:
Example
card.currentList().setName("I have "+card.name());

(static) this.setName()

Set a new name for this Attachment

Source:
Example
new Notification(posted).attachedFile().setName("You attachmed me on "+Trellinator.now().toLocaleString());

(static) this.setPosition(pos)

Set the position of a list

Parameters:
Name Type Description
pos string | float

top, bottom, or a positive float

Source:
Example
var to_board = new Trellinator().board("Some Board");
new Notification(posted).addedCard().currentList().setPosition("bottom");

(static) this.sort()

Sort the list, defaults to sort alphabetically in ascending order, but you can pass in a callback function too.

The following standard comparators are available:

  • List.SORT_DATE_DESC
  • List.SORT_DATE_ASC
  • List.SORT_ALPHA_DESC
  • List.SORT_TIME_IN_LIST_DESC
  • List.SORT_TIME_IN_LIST_ASC
Source:
Example
card.currentList().sort(List.SORT_DATE_DESC);

(static) this.unArchive()

Unarchive this list

Source:
Example
card.currentList().unArchive();