From 55b9bc44ed1e7b059a2b0b81f7ad6fe7437330af Mon Sep 17 00:00:00 2001 From: chriddyp Date: Fri, 22 Dec 2017 13:22:02 -0500 Subject: [PATCH 1/3] support for custom column_widths --- dash_table_experiments/metadata.json | 17 +++++++++++++++++ src/components/DataTable.react.js | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/dash_table_experiments/metadata.json b/dash_table_experiments/metadata.json index 7070f4d..f02726f 100644 --- a/dash_table_experiments/metadata.json +++ b/dash_table_experiments/metadata.json @@ -91,6 +91,13 @@ "params": [], "returns": null }, + { + "name": "getMinHeight", + "docblock": null, + "modifiers": [], + "params": [], + "returns": null + }, { "name": "onRowsSelected", "docblock": null, @@ -169,6 +176,16 @@ "computed": false } }, + "column_widths": { + "type": { + "name": "arrayOf", + "value": { + "name": "number" + } + }, + "required": false, + "description": "" + }, "columns": { "type": { "name": "arrayOf", diff --git a/src/components/DataTable.react.js b/src/components/DataTable.react.js index e0e8d2f..ef2a177 100644 --- a/src/components/DataTable.react.js +++ b/src/components/DataTable.react.js @@ -89,6 +89,11 @@ class DataTable extends Component { sortable: Boolean(props.sortable), filterable: Boolean(props.filterable) })); + if (props.column_widths) { + newState.columns.forEach((c, i) => { + c.width = props.column_widths[i]; + }); + } this.setState(newState); } @@ -322,6 +327,8 @@ DataTable.propTypes = { editable: PropTypes.bool, filterable: PropTypes.bool, sortable: PropTypes.bool, + column_widths: PropTypes.arrayOf(PropTypes.number), + /** * Order of columns. Note that the column names are specified in * `rows` but without order. This attribute allows you to specify From c2ff784aa8c9f4676a9998146c070985e2d22cd5 Mon Sep 17 00:00:00 2001 From: chriddyp Date: Fri, 22 Dec 2017 13:22:13 -0500 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39f9480..f4bf0a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,22 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## 0.5.1 -`datatable` now automatically resizes to fit data that has less than 10 rows. +### Added +- `DataTable` now automatically resizes to fit data that has less than 10 rows. +- A `column_widths` property can be used to set the column widths of the +`DataTable`. Simple example: +```python +ROWS = [ + {'a': 'AA', 'b': 1}, + {'a': 'AB', 'b': 2}, +] + +dt.DataTable( + rows=ROWS, + columns=['a', 'b'], + column_widths=[200, 400] +) +``` ## 0.5.0 ### Added From 3a176c8f990171765312c6b7c87fdba3123f1a36 Mon Sep 17 00:00:00 2001 From: chriddyp Date: Fri, 22 Dec 2017 13:23:45 -0500 Subject: [PATCH 3/3] v0.5.2 --- CHANGELOG.md | 7 +++++-- dash_table_experiments/version.py | 2 +- package.json | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4bf0a1..1d00946 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,8 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## 0.5.1 +## 0.5.2 ### Added -- `DataTable` now automatically resizes to fit data that has less than 10 rows. - A `column_widths` property can be used to set the column widths of the `DataTable`. Simple example: ```python @@ -20,6 +19,10 @@ dt.DataTable( ) ``` +## 0.5.1 +### Added +- `DataTable` now automatically resizes to fit data that has less than 10 rows. + ## 0.5.0 ### Added - `filterable=True`, `sortable=True`, and `row_selectable=True` all work well with each other diff --git a/dash_table_experiments/version.py b/dash_table_experiments/version.py index 93b60a1..45869b6 100644 --- a/dash_table_experiments/version.py +++ b/dash_table_experiments/version.py @@ -1 +1 @@ -__version__ = '0.5.1' +__version__ = '0.5.2' diff --git a/package.json b/package.json index 5ed03ec..866e8b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dash-table-experiments", - "version": "0.5.1", + "version": "0.5.2", "description": "Dash table experiments", "main": "lib/index.js", "repository": {