-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Adds support for header_value
for export header
#970
base: master
Are you sure you want to change the base?
Conversation
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.
Looks good, I have added some suggestions.
column_header_value = self.column.header_value | ||
if column_header_value: | ||
return column_header_value | ||
return self.header |
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.
I think we can safely write this as:
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`. |
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.
customized using :meth:`~Column.render_value`. | |
customized using :meth:`~Column.render_value`. |
@@ -80,6 +80,10 @@ By default, it just calls the `render()` method on that column. | |||
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 |
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.
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` |
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.
Isn't unicode
a python 2 construct?
:returns: `unicode` or `None` | |
:returns: `str` or `None` |
If this is used for exporting, would it make sense to have “export” in the argument name? |
Yes, I think |
Summary
A potential solve for #947.
Adds a
header_value
property onColumn
andBoundColumn
, analogous to the currentheader
property. Then, adjustsas_values
to use theheader_value
property for export column headers. Theheader_value
property returnsheader
for backwards compatibility, but provides a way to customize export headers independently of headers in the html table view. This is important becauseheader
may include custom HTML that shouldn't be included in export formats.