Get List of Cards based on Board - Trello API
api, trello
Solution
You need to use a different resource
Instead of using `members/me/cards`, use `boards/[board_id]/cards`
Just add an ID to your select and the board id to each option...
var $boards = $("<select>")
.attr("id", "boards") /* we'll use this later */
.text("Loading Boards...")
.appendTo("#output");
$("<option>")
/* notice the added board id value */
.attr({href: board.url, target: "trello", value : board.id})
.addClass("board")
.text(board.name)
.appendTo($boards);
And then you can grab all cards for just that board
var resource = "boards/" . $("#boards").val() . "/cards";
Trello.get(resource, function(cards) {
// rest of code...
});
Problem
I am trying to return a list of cards based on the board a user chooses from a dropdown select menu. DEMO http://jsfiddle.net/nNesx/1378/ I have Created the list of boards as follows ``` var $boards = $("<select>") .text("Loading Boards...") .appendTo("#output"); // Output a list of all of the boards that the member // is assigned to Trello.get("members/me/boards", function(boards) { $boards.empty(); $.each(boards, function(ix, board) { $("<option>") .attr({href: board.url, target: "trello"}) .addClass("board") .text(board.name) .appendTo($boards); }); }); ``` which gives me a dropdown select of all boards available. Once the user chooses the board I then want them to see the cards for that board. I am using this code for cards, but all cards just appear. ``` var $cards = $("<div>") .text("Loading Boards...") .appendTo("#outputCards"); // Output a list of all of the boards that the member // is assigned to based on what they choose in select dropdown Trello.get("members/me/cards", function(cards) { $cards.empty(); $.each(cards, function(ix, card) { $("<a>") .attr({href: card.url, target: "trello"}) .addClass("card") .text(card.name) .appendTo($cards); }); }); ``` I am not sure how to display the cards based on the select drop-down? DEMO http://jsfiddle.net/nNesx/1378/