-
-
Notifications
You must be signed in to change notification settings - Fork 73
Sorting sorts ascending first and displays correct icon #164
Changes from 8 commits
5be5338
d03c69d
1a0ab20
3215fea
aa1d8a7
474f965
f4c16c5
96a6979
ba9ef76
756652d
d0acd81
8025e27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,32 @@ | |
"src/dash-table/Table.js": { | ||
"description": "", | ||
"displayName": "Table", | ||
"methods": [], | ||
"methods": [ | ||
{ | ||
"name": "isFrontEnd", | ||
"docblock": null, | ||
"modifiers": [], | ||
"params": [ | ||
{ | ||
"name": "value", | ||
"type": null | ||
} | ||
], | ||
"returns": null | ||
}, | ||
{ | ||
"name": "isBackEnd", | ||
"docblock": null, | ||
"modifiers": [], | ||
"params": [ | ||
{ | ||
"name": "value", | ||
"type": null | ||
} | ||
], | ||
"returns": null | ||
} | ||
], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah! I think that's exactly why I defined this methods in the render function originally! |
||
"props": { | ||
"active_cell": { | ||
"type": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,23 +7,29 @@ import 'dash-table/style/component.less'; | |
import Logger from 'core/Logger'; | ||
|
||
export default class Table extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.isFrontEnd = this.isFrontEnd.bind(this); | ||
this.isBackEnd = this.isBackEnd.bind(this); | ||
} | ||
isFrontEnd(value) { | ||
return ['fe', true, false].indexOf(value) !== -1; | ||
} | ||
|
||
isBackEnd(value) { | ||
return ['be', false].indexOf(value) !== -1; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't really part of the issue this PR fixes, but it's a nice fix anyway. Note that the way we have our webpack and babel configs set up now, using arrow functions as class methods throws an error upon building, hence the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment above in metadata.json, otherwise 👍 |
||
|
||
render() { | ||
const { | ||
filtering, | ||
sorting, | ||
pagination_mode | ||
} = this.props; | ||
|
||
function isFrontEnd(value: any) { | ||
return ['fe', true, false].indexOf(value) !== -1; | ||
} | ||
|
||
function isBackEnd(value: any) { | ||
return ['be', false].indexOf(value) !== -1; | ||
} | ||
|
||
const isValid = isFrontEnd(pagination_mode) || | ||
(isBackEnd(filtering) && isBackEnd(sorting)); | ||
const isValid = this.isFrontEnd(pagination_mode) || | ||
(this.isBackEnd(filtering) && this.isBackEnd(sorting)); | ||
|
||
if (!isValid) { | ||
Logger.error(`Invalid combination of filtering / sorting / pagination`, filtering, sorting, pagination_mode); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ describe('select row', () => { | |
it('select, sort, new row is not selected', () => { | ||
DashTable.getSelect(0).within(() => cy.get('input').click()); | ||
DashTable.getSelect(0).within(() => cy.get('input').should('be.checked')); | ||
cy.get('tr th.column-0 .sort').last().click({ force: true }); | ||
cy.get('tr th.column-0 .sort').last().click({ force: true }).click({ force: true }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Double-click to sort twice so the values actually change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, this is the only case where it matters throughout the existing tests as here the derived_viewport_data was still in the same order as the original data. |
||
DashTable.getSelect(0).within(() => cy.get('input').should('not.be.checked')); | ||
}); | ||
}); | ||
|
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.
Include a link to the issue here since we have it.