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

column header with spaces #133

Open
michaelmarzec opened this issue Jan 25, 2022 · 2 comments
Open

column header with spaces #133

michaelmarzec opened this issue Jan 25, 2022 · 2 comments

Comments

@michaelmarzec
Copy link

Is there a way to use column headers that have a space in them?

For example, I'm using the sortableTable class and \Team_Name = Col('Team_Name), which works well. However, is there a way to use this library/function if I wanted to rename my column header to 'Team Name'?

@plumdog
Copy link
Owner

plumdog commented Jan 25, 2022

Hi @michaelmarzec,

The string that you pass as the first argument to Col is used as the table header, eg:

from flask_table import Table, Col

class ItemTable(Table):
    name = Col('Name with spaces')
    description = Col('Description with with spaces')

items = [{'name': 'Name1', 'description':  'Description1'}]
table = ItemTable(items)
print(table.__html__())

outputs:

<table>
<thead><tr><th>Name with spaces</th><th>Description with with spaces</th></tr></thead>
<tbody>
<tr><td>Name1</td><td>Description1</td></tr>
</tbody>
</table>

which is

Name with spacesDescription with with spaces
Name1Description1

@michaelmarzec
Copy link
Author

Understood - was misinterpreting the use of the Col() function. Thank you very much for the quick response!

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

No branches or pull requests

2 participants