diff --git a/app/components/p8p_data_grid.js b/app/components/p8p_data_grid.js index 441aac0..fc743cc 100644 --- a/app/components/p8p_data_grid.js +++ b/app/components/p8p_data_grid.js @@ -44,7 +44,7 @@ const P8PDataGrid = ({ fixedHeader = false, fixedColumns = 0, morePages = false, - reloading, + reloading = false, expandable, orderAscMenuItemCaption, orderDescMenuItemCaption, @@ -162,7 +162,7 @@ P8PDataGrid.propTypes = { fixedHeader: PropTypes.bool, fixedColumns: PropTypes.number, morePages: PropTypes.bool, - reloading: PropTypes.bool.isRequired, + reloading: PropTypes.bool, expandable: PropTypes.bool, orderAscMenuItemCaption: PropTypes.string.isRequired, orderDescMenuItemCaption: PropTypes.string.isRequired, diff --git a/app/components/p8p_table.js b/app/components/p8p_table.js index f5d3c31..0cb7c34 100644 --- a/app/components/p8p_table.js +++ b/app/components/p8p_table.js @@ -118,7 +118,9 @@ const STYLES = { }, TABLE_CELL_EXPAND_CONTAINER: { paddingBottom: 0, - paddingTop: 0 + paddingTop: 0, + paddingLeft: 0, + paddingRight: 0 }, TABLE_CELL_GROUP_HEADER: { backgroundColor: "lightgray" @@ -495,7 +497,7 @@ const P8PTable = ({ fixedHeader = false, fixedColumns = 0, morePages = false, - reloading, + reloading = false, expandable, orderAscMenuItemCaption, orderDescMenuItemCaption, @@ -531,7 +533,9 @@ const P8PTable = ({ const [expanded, setExpanded] = useState({}); //Собственное состояния - развёрнутые группы - const [expandedGroups, setExpandedGroups] = useState({}); + const [expandedGroups, setExpandedGroups] = useState( + Array.isArray(groups) && groups.length > 0 ? Object.assign({}, ...groups.map(g => ({ [g.name]: g.expanded }))) : {} + ); //Собственное состояние - колонка с отображаемой подсказкой const [displayHintColumn, setDisplayHintColumn] = useState(null); @@ -931,7 +935,7 @@ P8PTable.propTypes = { fixedHeader: PropTypes.bool, fixedColumns: PropTypes.number, morePages: PropTypes.bool, - reloading: PropTypes.bool.isRequired, + reloading: PropTypes.bool, expandable: PropTypes.bool, orderAscMenuItemCaption: PropTypes.string.isRequired, orderDescMenuItemCaption: PropTypes.string.isRequired,