-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4032 from donker/usersorting
Implement clickable column headers on the users table
- Loading branch information
Showing
6 changed files
with
84 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 34 additions & 16 deletions
50
...rience/ClientSide/Users.Web/src/_exportables/src/components/UserTable/HeaderRow/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,45 @@ | ||
import PropTypes from 'prop-types'; | ||
import PropTypes from "prop-types"; | ||
import React, { Component } from "react"; | ||
import { GridCell } from "@dnnsoftware/dnn-react-common"; | ||
import "./style.less"; | ||
|
||
class ExtensionHeader extends Component { | ||
render() { | ||
return ( | ||
<GridCell columnSize={100} className="header-row"> | ||
{ | ||
this.props.headers.map((header, index) => { | ||
return <GridCell key={`header-row-grid-cell-${index}`} columnSize={header.size} className={header.header ? "" : "empty"}> | ||
<h6>{header.header || "Default"}</h6> | ||
</GridCell>; | ||
}) | ||
} | ||
render() { | ||
return ( | ||
<GridCell columnSize={100} className="header-row"> | ||
{this.props.headers.map((header, index) => { | ||
return ( | ||
<GridCell | ||
key={`header-row-grid-cell-${index}`} | ||
columnSize={header.size} | ||
className={ | ||
(header.header ? "" : "empty") + | ||
(header.isSortable ? " sortable" : "") | ||
} | ||
onClick={(e) => { | ||
if (this.props.changeSortOrder && header.isSortable) | ||
this.props.changeSortOrder( | ||
header.columnName, | ||
header.columnName == this.props.currentSortColumn | ||
? !this.props.currentSortAscending | ||
: true | ||
); | ||
}} | ||
> | ||
<h6>{header.header || "Default"}</h6> | ||
</GridCell> | ||
); | ||
} | ||
); | ||
})} | ||
</GridCell> | ||
); | ||
} | ||
} | ||
|
||
ExtensionHeader.propTypes = { | ||
headers: PropTypes.array.isRequired | ||
headers: PropTypes.array.isRequired, | ||
changeSortOrder: PropTypes.func, | ||
currentSortAscending: PropTypes.bool, | ||
currentSortColumn: PropTypes.string, | ||
}; | ||
|
||
|
||
export default ExtensionHeader; | ||
export default ExtensionHeader; |
25 changes: 14 additions & 11 deletions
25
...ience/ClientSide/Users.Web/src/_exportables/src/components/UserTable/HeaderRow/style.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
@import "~@dnnsoftware/dnn-react-common/styles/index.less"; | ||
.header-row { | ||
padding: 10px 0 10px; | ||
border-bottom: 1px solid @alto; | ||
.dnn-grid-cell { | ||
padding: 0 15px; | ||
} | ||
.dnn-grid-cell.empty{ | ||
text-indent: -100px; | ||
overflow: hidden; | ||
} | ||
text-transform: uppercase; | ||
} | ||
padding: 10px 0 10px; | ||
border-bottom: 1px solid @alto; | ||
.dnn-grid-cell { | ||
padding: 0 15px; | ||
} | ||
.dnn-grid-cell.empty { | ||
text-indent: -100px; | ||
overflow: hidden; | ||
} | ||
text-transform: uppercase; | ||
.sortable { | ||
cursor: pointer; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters