Filtering epics from Kanban board

可紊 提交于 2019-12-02 03:40:02

Mark's answer caused an obscure crash when cardboard.setItems(filteredItems) was called. However, since the filtering code is actually manipulating the actual references, it turns out that setItems() method is actually not needed. I pulled it out, and it now filters properly.

Per Charles' hint in Rally Kanban - hiding Epic Stories

Here's how I approached this following Charles' hint for the Rally Catalog Kanban. First, modify the fetch statement inside the cardboardConfig so that it includes the Children collection, thusly:

      fetch: "Name,FormattedID,Children,Owner,ObjectID,Rank,Ready,Blocked,LastUpdateDate,Tags,State"

Next, in between this statement:

      cardboard.addEventListener("preUpdate", that._onBeforeItemUpdated);   

And this statement:

     cardboard.display("kanbanBoard");

Add the following event listener and callback:

    cardboard.addEventListener("onDataRetrieved", 
        function(cardboard, args){
            // Grab items hash
            filteredItems = args.items;

            // loop through hash keys (states)
            for (var key in filteredItems) {

                // Grab the workproducts objects (Stories, defects)                 
                workproducts = filteredItems[key];
                // Array to hold filtered results, childless work products
                childlessWorkProducts = new Array();
                // loop through 'em and filter for the childless
                for (i=0;i<workproducts.length;i++) {
                    thisWorkProduct = workproducts[i];                      
                    // Check first if it's a User Story, since Defects don't have children
                    if (thisWorkProduct._type == "HierarchicalRequirement") {
                        if (thisWorkProduct.Children.length === 0 ) {
                            childlessWorkProducts.push(thisWorkProduct);
                        }
                    } else {
                        // If it's a Defect, it has no children so push it
                        childlessWorkProducts.push(thisWorkProduct);
                    } 
                }
                filteredItems[key] = childlessWorkProducts;
            }
            // un-necessary call to cardboard.setItems() was here - removed
        }
    );

This callback should filter for only leaf-node items.

Not sure this is your problem but your cardboard config does not set the 'query' field. The fetch is the type of all data to retrieve if you want to filter it you add a "query:" value to the config object. Something like :

        var cardboardConfig = {
         types: ["PortfolioItem", "HierarchicalRequirement", "Feature"],
         attribute: dropdownAttribute,
         fetch:"Name,FormattedID,Owner,ObjectID,ClassofService",
         query : fullQuery,
         cardRenderer: PriorityCardRenderer
    };

Where fullQuery can be constructed using the the Rally query object. You find it by searching in the SDK. Hope that maybe helps.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!