Adds support for header_value for export header#970
Open
5tefan wants to merge 1 commit into
Open
Conversation
jieter
reviewed
Dec 21, 2024
jieter
left a comment
Owner
There was a problem hiding this comment.
Looks good, I have added some suggestions.
Comment on lines
+582
to
+585
| column_header_value = self.column.header_value | ||
| if column_header_value: | ||
| return column_header_value | ||
| return self.header |
Owner
There was a problem hiding this comment.
I think we can safely write this as:
Suggested change
| column_header_value = self.column.header_value | |
| if column_header_value: | |
| return column_header_value | |
| return self.header | |
| return column_header_value or self.header |
|
|
||
| When subclassing a column, the header in the html table can be customized by | ||
| overriding :meth:`~Column.header`. The header value for exports can be independently | ||
| customized using :meth:`~Column.render_value`. |
Owner
There was a problem hiding this comment.
Suggested change
| customized using :meth:`~Column.render_value`. | |
| customized using :meth:`~Column.render_value`. |
| If your custom column produces HTML, you should override this method and return | ||
| the actual value. | ||
|
|
||
| For column headers, similarly sometimes :ref:Column.header`-may include html which |
Owner
There was a problem hiding this comment.
Suggested change
| For column headers, similarly sometimes :ref:Column.header`-may include html which | |
| For column headers, similarly sometimes :ref:Column.header`-may include HTML which |
|
|
||
| By default this returns `~.Column.header`. | ||
|
|
||
| :returns: `unicode` or `None` |
Owner
There was a problem hiding this comment.
Isn't unicode a python 2 construct?
Suggested change
| :returns: `unicode` or `None` | |
| :returns: `str` or `None` |
Contributor
|
If this is used for exporting, would it make sense to have “export” in the argument name? |
Owner
Yes, I think |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A potential solve for #947.
Adds a
header_valueproperty onColumnandBoundColumn, analogous to the currentheaderproperty. Then, adjustsas_valuesto use theheader_valueproperty for export column headers. Theheader_valueproperty returnsheaderfor backwards compatibility, but provides a way to customize export headers independently of headers in the html table view. This is important becauseheadermay include custom HTML that shouldn't be included in export formats.