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

Set headers #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sergiyvoytovych
Copy link

Added possibility to set header for a column

//cols
res.cols = fields.map(function(key,i) {
return {
caption: headers[i],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When config is undefined, fields instanceof Array === true.
So it would not go in to the if case telling in line 56 and headers remain [].

When json is not empty([] || {}), fields is also not empty, then headers would not match fields.
headers[i] in line 68 would be undefined, resulting to the following failure of test.

image

## fix it
Replace headers[i] to headers[i] !== undefined ? headers[i] : key in line 68.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants