-
Notifications
You must be signed in to change notification settings - Fork 431
Development/sorted classes and style #136
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
Conversation
|
@Chun-MingChen I just wondering why you have following design: sortedHeader: {
classes: ....
styles: ....
}Our cell, row, selection and cell edit always separate classes and styles as two different prop |
d9be2c2 to
7280e3c
Compare
|
Sure it does be inconsistent. I've fixed it to separate |
docs/README.md
Outdated
|
|
||
| ### <a name='sortingHeaderStyle'>sortingHeaderStyle - [Object | Function]</a> | ||
|
|
||
| It's similiar to `sortingHeaderClasses`. It allows to customize style of `header cell` which is sorting based on. `Object` and `callback` function are acceptable. `callback` takes `2` arguments and an `Object` is expected to return: |
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.
An style object or callback function are acceptable
docs/README.md
Outdated
| Furthermore, it also accepts a callback function which takes `2` arguments and `String` is expected to return: | ||
|
|
||
| ```js | ||
| const sortingHeaderClasses = function callback(column, colIndex) { ... } |
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.
es6 style
docs/README.md
Outdated
| ``` | ||
|
|
||
| * column: The value of current column. | ||
| * colIndex: The index of the current column being processed in BootstrapTable. |
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.
Additional pass sort order to callback function as third argument
7280e3c to
af095c0
Compare
f438426 to
1014de2
Compare
|
Hi @AllenFang: Sorry for commit late. After our discussion, I implemented header sorting classes and style in column level. Furthermore, |
AllenFang
left a comment
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.
good job, but something need to change.
docs/columns.md
Outdated
| ### <a name='headerSortingClasses'>headerSortingClasses - [String | Function]</a> | ||
|
|
||
| `headerSortingClasses` allows to customize `class` for header cell which the table was sorting based on. |
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.
headerSortingClasses allows to customize class for header cell when this column is sorting
docs/columns.md
Outdated
|
|
||
| * `column`: The value of current column. | ||
| * `sortOrder`: The order of current sorting | ||
| * `isLastSorting`: Is the last one of sorting. |
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.
Is the last one of sorted columns.
docs/columns.md
Outdated
|
|
||
| ### <a name='headerSortingStyle'>headerSortingStyle - [Object | Function]</a> | ||
|
|
||
| It's similiar to [headerSortingClasses](#headerSortingClasses). It allows to customize the style of header cell which the table was sorting based on. A style `Object` and `callback` are acceptable. `callback` takes **4** arguments and an `Object` is expected to return: |
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.
It allows to customize the style of header cell when this column is sorting
| data={ products } | ||
| columns={ columns } | ||
| defaultSorted={ defaultSorted } | ||
| /> |
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.
Thanks
| .add('Default Sort Table', () => <DefaultSortTable />) | ||
| .add('Custom Sort Fuction', () => <CustomSortTable />); | ||
| .add('Custom Sort Fuction', () => <CustomSortTable />) | ||
| .add('Header sorting classes', () => <HeaderSortingClassesTable />) |
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.
Custom Classes on Sorting Header Column
| .add('Custom Sort Fuction', () => <CustomSortTable />); | ||
| .add('Custom Sort Fuction', () => <CustomSortTable />) | ||
| .add('Header sorting classes', () => <HeaderSortingClassesTable />) | ||
| .add('Header sorting style', () => <HeaderSortingStyleTable />); |
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.
Custom Style on Sorting Header Column
| }); | ||
| }); | ||
|
|
||
| describe('when headerSortingClasses was defined ', () => { |
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.
when headerSortingClasses is defined
| />); | ||
| }); | ||
|
|
||
| it('should append classes correcly', () => { |
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.
should + V-ing
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 thought that will be great for should + VR :)
| }); | ||
| }); | ||
|
|
||
| describe('if column.headerClasses was defined as well', () => { |
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.
if column.headerClasses is defined as well
| }); | ||
| }); | ||
|
|
||
| describe('when headerSortingStyle was defined', () => { |
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.
is
5092908 to
90cada4
Compare
fix #126 and #127
Hi @AllenFang, the PR aims to support sorted
classesandstyle. Please take a look, thanks :)classesandstyle.