Skip to content
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

Added support for passing function handles as columns formatters #11

Merged
merged 1 commit into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dash_tabulator/package-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"author": "patrick oleary <pjaol+dash@pjaol.com>",
"license": "MIT",
"dependencies": {
"dash-extensions": "0.0.1",
"ramda": "^0.26.1",
"react-tabulator": "^0.14.2",
"set-blocking": "^2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"author": "patrick oleary <pjaol+dash@pjaol.com>",
"license": "MIT",
"dependencies": {
"dash-extensions": "0.0.1",
"ramda": "^0.26.1",
"react-tabulator": "^0.14.2",
"set-blocking": "^2.0.0"
Expand Down
9 changes: 7 additions & 2 deletions src/lib/components/DashTabulator.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import PropTypes, { array } from 'prop-types';
import 'react-tabulator/lib/styles.css'; // required styles
import 'react-tabulator/lib/css/tabulator.min.css'; // theme
import { ReactTabulator } from 'react-tabulator'
import {resolveProps} from 'dash-extensions'

/**
* DashTabulator is an implementation of the React Tabulator from
Expand Down Expand Up @@ -37,9 +38,13 @@ export default class DashTabulator extends Component {
}

render() {
const {id, data, setProps, columns, options, rowClicked, cellEdited, dataChanged,
const {id, data, setProps, columns, options, rowClicked, cellEdited, dataChanged,
downloadButtonType, clearFilterButtonType, initialHeaderFilter, dataFiltering, dataFiltered} = this.props;

// Interpret column formatters as function handles.
for(let i=0; i < columns.length; i++){
columns[i] = resolveProps(columns[i], ["formatter"])
}

const options2 = {...options,
downloadDataFormatter: (data) => data,
downloadReady: (fileContents, blob) => blob
Expand Down