Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Commit

Permalink
feat(DataTable): Add sorting params to header onClick callback (#2083)
Browse files Browse the repository at this point in the history
* feat(DataTable): Add sorting params to header onClick callback

* chore(build): update size threshold

* fix(progressIndicatorSkeleton): Update html to fix styling (#2084)

* fix: update skeleton svg for progress indicator

* chore: update html

* refactor(Slider): replace Carbon TextInput (#2085)

* feat(DataTable): Add sorting params to header onClick callback
  • Loading branch information
moczolaszlo authored and asudoh committed Mar 27, 2019
1 parent 12ab708 commit e76d696
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,5 +363,5 @@
"enzyme-to-json/serializer"
]
},
"bundleSizeThreshold": 110000
"bundleSizeThreshold": 120000
}
21 changes: 20 additions & 1 deletion src/components/DataTable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,29 @@ export default class DataTable extends React.Component {
isSortHeader: sortHeaderKey === header.key,
// Compose the event handlers so we don't overwrite a consumer's `onClick`
// handler
onClick: composeEventHandlers([this.handleSortBy(header.key), onClick]),
onClick: composeEventHandlers([
this.handleSortBy(header.key),
onClick
? this.handleOnHeaderClick(onClick, {
sortHeaderKey: header.key,
sortDirection,
})
: null,
]),
};
};

/**
* Decorate consumer's `onClick` event handler with sort parameters
*
* @param {Function} onClick
* @param {Object} sortParams
* @returns {Function}
*/
handleOnHeaderClick = (onClick, sortParams) => {
return e => onClick(e, sortParams);
};

/**
* Get the props associated with the given row. Mostly used for expansion.
*
Expand Down

0 comments on commit e76d696

Please sign in to comment.