Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Ths2-9Y-LqJt6 opened this issue Sep 24, 2018 · 2 comments

Comments

@Ths2-9Y-LqJt6
Copy link
Contributor

commented Sep 24, 2018

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);
}

@Ths2-9Y-LqJt6 Ths2-9Y-LqJt6 added the bug label Sep 24, 2018

@melalj

This comment has been minimized.

Copy link
Member

commented Oct 22, 2018

Found out that there was a double rendering for table. Fixed on #90

@Ths2-9Y-LqJt6

This comment has been minimized.

Copy link
Contributor Author

commented Nov 14, 2018

about to release 1.7.0, closing this as one of the fixes in that release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.