khan4019/tree-grid-directive

Last column Appearing Twice

Closed this issue · 1 comments

Hello,

I am trying to create dynamic tree-grid information and for some reason the last column is appearing twice as the first and last column and is ignoring what I have actually as the first and last column.

This is how I have it setup:

$scope.treeData = [];

$scope.colDefs = [
{field: "Answered", displayName: "Answered"},
{field: "Total", displayName: "Total"},
{field: "Percentage", displayName: "Percentage"}
];

$scope.updateTreeData = function() {
console.log('Updating tree data', true);
$scope.treeData = [];

        for (var i = 0; i < $scope.quesnrList.length; i++) {
            var quesnr = $scope.quesnrList[i];
            var quesnrName = quesnr.Name;
            var answered = 0;
            var total = 0;

            for (var j = 0; j < quesnr.detailedQuestions.length; j++) {
                var detailedQuestion = quesnr.detailedQuestions[j];
                for (var k = 0; k < detailedQuestion.questions.length; k++) {
                    var question = detailedQuestion.questions[k];
                    console.log("Question=", question);
                    total += 1;
                    if (question.selectedAnswer.answered) {
                        answered += 1;
                    }
                }
            }

            $scope.treeData.push(
                    {
                        Name: quesnrName,
                        Answered: answered,
                        Total: total,
                        Percentage: ((answered/total) * 100) + '%'
                    }
            );
        }
         };

has anyone else experienced this issue?

I figured out. I wasnt passing in the expanding property or giving it the name. After doing so, it worked fine