-
Notifications
You must be signed in to change notification settings - Fork 428
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
Allow use of custom class names for ordered columns through header at… #329
Conversation
I wasn't entirely sure if the I decided that putting header attributes into If opinions differ, give me a better direction to go and I'll attempt to improve on it. I'll create Docs if it is decided that this implementation is in the right direction for this project. Thanks! |
Usage would be: class MyTable(tables.Table):
[...]
Meta:
header_attrs = {
'orderable': 'sortable', # Custom ordered class
'descending': 'descend', # Custom descending class
'ascending': 'ascend' # Custom ascending class
} |
Your point about changing it for a complete table makes sense. I didn't mean to forbid these kind of args to the table constructor, but as said, it's already crowded so we need to consider things carefully. |
Remove header_attrs from table constructor
Remove attrs comment? Rename blocklist to blacklist New assert, verify table's class does not get put into th's class
How about this approach.. The most recent commits are what this is. Instead of having header_attrs in the constructor, a For example: Table(queryset, attrs={
'th': {
'class': 'custom-header-class',
'_ordering': {
'orderable': 'sort',
'ascending': 'ascending',
'descending': 'descending'
}
}
}) This will also work for Table(queryset, attrs={
'td': {
'class': 'custom-header-class'
}
}) Hope this made sense. If you're into this approach then I'll write some documentation. (In a more clear manner and more in-depth.) |
@thetarkus thanks for trying another approach. What I like about this is that it's more along the lines for what we have in place for column attributes in Let's go with this and see how it works out. |
@thetarkus looks good, merging |
…tributes