Get List of Cards based on Board - Trello API -
i trying return list of cards based on board user chooses dropdown select menu.
demo http://jsfiddle.net/nnesx/1378/
i have created list of boards follows
var $boards = $("<select>") .text("loading boards...") .appendto("#output"); // output list of of boards member // assigned 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 dropdown select of boards available.
once user chooses board want them see cards board. using code cards, cards appear.
var $cards = $("<div>") .text("loading boards...") .appendto("#outputcards"); // output list of of boards member // assigned based on 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 not sure how display cards based on select drop-down?
you need use different resource
instead of using members/me/cards
, use boards/[board_id]/cards
just add id select , board id each option...
var $boards = $("<select>") .attr("id", "boards") /* we'll use later */ .text("loading boards...") .appendto("#output"); $("<option>") /* notice added board id value */ .attr({href: board.url, target: "trello", value : board.id}) .addclass("board") .text(board.name) .appendto($boards);
and can grab cards board
var resource = "boards/" . $("#boards").val() . "/cards"; trello.get(resource, function(cards) { // rest of code... });
Comments
Post a Comment