Skip to content

Filtering out all values returns empty array. Should return remaining unfiltered fields with 0 values. #60

Description

@turnerniles

Filtering out all values returns empty array. Should return remaining unfiltered fields with 0 values.

const dataArray = [ ['name', 'gender', 'house', 'age'], ['Jon', 'm', 'Stark', 14], ['Arya', 'f', 'Stark', 10], ['Cersei', 'f', 'Baratheon', 38], ['Tywin', 'm', 'Lannister', 67], ['Tyrion', 'm', 'Lannister', 34], ['Joffrey', 'm', 'Baratheon', 18], ['Bran', 'm', 'Stark', 8], ['Jaime', 'm', 'Lannister', 32], ['Sansa', 'f', 'Stark', 12] ];

const testPivot = new pivot(dataArray, ['house', 'gender'], [], 'age', 'sum', '');

testPivot.filter('gender', ['f','m'], 'exclude')

testPivot.data.table
returns []

Instead it should return
"[{"value":["",""],"depth":0,"type":"colHeader","row":0},{"value":["Baratheon",0],"type":"data","depth":0,"row":1},{"value":["Lannister",0],"type":"data","depth":0,"row":2},{"value":["Stark",0],"type":"data","depth":0,"row":3}]"

Or if this is a tremendous amount of work perhaps just the empty header.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions