Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
don't allow sort if sortable is false on layout #1414
Browse files Browse the repository at this point in the history
  • Loading branch information
wiadev committed Dec 7, 2017
1 parent 75c2b23 commit 04afa3f
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/components/table/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@ class TableHeader extends Component {
super(props);
}

renderSorting = (field, caption) => {
const {sort, orderBy, deselect, page, tabid} = this.props;
handleClick = (field, sorting, sortable) => {
if (!sortable) {
return;
}

const {sort, deselect, page, tabid} = this.props;

sort(!sorting.asc, field, true, page, tabid);
deselect();
}

renderSorting = (field, caption, sortable) => {
const { orderBy } = this.props;
let sorting = {};
orderBy && orderBy.map((item) => {
if(field == item.fieldName){
Expand All @@ -18,10 +29,7 @@ class TableHeader extends Component {
return (
<div
className="sort-menu"
onClick={() => {
sort(!sorting.asc, field, true, page, tabid);
deselect();
}}
onClick={() => this.handleClick(field, sorting, sortable)}
>
<span title={caption} className="th-caption">{caption}</span>
<span
Expand All @@ -47,8 +55,8 @@ class TableHeader extends Component {
className={getSizeClass(item)}
>
{sort ?
this.renderSorting(item.fields[0].field, item.caption):
item.caption
this.renderSorting(item.fields[0].field, item.caption,
item.sortable) : item.caption
}
</th>
);
Expand Down

0 comments on commit 04afa3f

Please sign in to comment.