-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Provide programmatic column header for table, stock example updated #560
Conversation
Still allows original example to function as-is. Allows non-hard-coded table column headers.
Supplied 3 examples of setting the columns; the original method, which requires the fixed html code for thead/cols; another which uses mostly the data element names which become capitalized as col headings, and another where most of the columns have the column label specified along with an accessor function. There is some code to strip a numberFormat/etc from a function converted to string, an attempt to auto-generate a column header from a function, in data-table.js, columnString().
I've since learned to pull a topic branch, and prior to the pull reversed the commit of the auto-built dc.js's. |
I'm not sure what is wrong, it passes the grunt test here and shows as synced. |
Installed saucelab. Retry |
Ah, went down a dark alley. Perhaps someone will smile gently and provide some wisdom for a newbie. |
Ah. I see this is a common Sauce problem at the moment. |
Hi @mr23, sorry for this bad first PR experience! and sorry I didn't intervene sooner. There is really nothing to worry about, I think the Sauce system changed last week and everything has been failing since. Your patch should be good if it passed the tests before that part. I'm tied up with other deadlines this week but will review your contribution soon. |
Ready |
How do we go about updating the API (https://github.com/dc-js/dc.js/blob/master/web/docs/api-latest.md)? The section on columns (.columns([columnFunctionArray])) still applies as-is, but I added additional functionality. |
Just add to the comment around This is a valuable contribution and I have seen other workarounds by other users. I have two comments so far:
|
Restored index.html, no need for a change. Added 4th example of columns.
so both header and value can be overridden
Changed to use just an in-line Object, and allow any Object specification desired, with note to override the internal functions to match. I think this is the cleanest and most flexible version.
Gordon, SC, |
// A 2nd option is a string representing a field in the data. | ||
// A third option is to supply an Object such as an array of 'information', and | ||
// supply your own _doColumnHeaderFormat and _doColumnValueFormat functions to | ||
// create what you need. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment confuses me. It doesn't look like one would provide _doColumnHeaderFormat and _doColumnValueFormat, but instead would supply the header string and a format function. Is this comment obsolete?
This looks really helpful. Using the example for testing is great, but could you add jasmine tests for the following cases?
For the Object formatting, I would prefer an object rather than an array. So, instead of
I would prefer something like:
It's a little more verbose but clearer. Thanks! |
Okay, I'll look into it next opportunity. |
Going to try and pick this back up. Could it still make a cutoff for 2.0 ? |
Yeah, I hope to release mid-week. |
Also, there shouldn't be quite such a long wait between releases after that! |
…r columns and add jasmine tests
This was subsumed/replaced by #668, which adds tests. |
Update: ready to go, April 5.