反应台仪表板组件
dash-react-table的Python项目详细描述
仪表板反应表
react table的仪表板部件
dash react table提供了构建在react-table之上的轻量级表组件。
注意:以上链接将带您进入版本6,这是我用于此组件的版本(准确地说是v6.8.6)
安装
dash react table位于pypi上,可以通过 运行
pip install dash-react-table
用法
importdashimportdash_html_componentsashtmlimportpandasaspdfromdash_react_tableimportDashReactTabledf=pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')data=df.to_json(orient='records')columns=[{'Header':i,'accessor':i}foriindf.columns]app.layout=html.Div([DashReactTable(id='table',data=data,columns=columns)])if__name__=='__main__':app.run_server(debug=True)
DashReactTable属性
Attribute | Description | Type | Default value |
---|---|---|---|
id | Optional identifier used to reference component in callbacks | string | |
data | An array of data | list of dict where each dict corresponds to a row of data | |
columns | An array of column attributes | list of dict which can contain the followings keys: Header(string), accessor(string), sortable(boolean), filterable(boolean), show(boolean), width(int), minWidth(int), maxWidth(int), className(string), style(string), headerClassName(string), headerStyle(string) | |
showPagination | Turn on pagination | boolean | false |
showPaginationTop | Put pagination on top | boolean | false |
showPaginationBottom | Put pagination on top | boolean | true |
showPageSizeOptions | Provide options for pagination | boolean | true |
pageSizeOptions | Define the size options for pagination | list of int | [5, 10, 20, 25, 50, 100] |
defaultPageSize | Default page size | int | 20 |
minRows | Controls the minimum number of rows to display | int | |
sortable | Allow columns to be sorted | boolean | true |
resizable | Allow columns to be resizable | boolean | true |
filterable | Allow columns to be filterable. The component has a custom filter which performs a case/order insensitive filter. | boolean | false |
className | Add classname to react-table. The main use case for this is to add "-striped" and/or "-highlight" | string | |
style | inline table styles | dict | |
conditionalFormatting | Custom conditional color formatting. Currently only supports d3.scaleThreshold. | dict with contains the following keys: domain(list of int), range(list of dict styles), ignore(list of string) |
附加注释:
所有列属性都可以覆盖表级属性
若要使用条件格式,n个域值必须有n+1个范围值。范围值必须是驼峰样式。
若要生成具有固定页眉的滚动表,请确保将固定高度添加到表的样式属性中。