Skip to content

cellContent: function(d) is called twice for every cell #87

@mrjones-plip

Description

@mrjones-plip

when using cellContent(), the function is called twice for every cell. When doing display work (eg make it a certain color) it's safe to do twice, but when doing statics, and for general performance, this is bad.

steps to reproduce:

  1. create a maptable with a cellContent() function.
  2. declare a var before the maptable: var count = 0;
  3. inside your cellContent() function add a line count += 1;

expected: count == number of rows in table
actual: count == 2 x number of rows in table


here's some prototypical code to illustrate the problem:

var rowCount = 0;
var viz = d3.maptable('#vizContainer')
.csv(URL_HERE)
.table()
.columns({
    Key: {
        cellContent: function(d){
            rowCount += 1;
            return d.Key;
        },
    },
})
.render(postProcess);
function postProcess() {
    console.log('row count: ' + rowCount);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions