From 68b3facc710021d7285d96391046029b2d49f10d Mon Sep 17 00:00:00 2001 From: Bryan Robert Tester Date: Tue, 17 Dec 2019 16:42:41 +0000 Subject: [PATCH] added seek to selected row + row select combobox in table --- .../table.container.test.js.snap | 77 +++++++++++++++++++ src/malcolmWidgets/table/table.container.js | 25 +++++- .../table/virtualizedTable.component.js | 4 +- 3 files changed, 103 insertions(+), 3 deletions(-) diff --git a/src/malcolmWidgets/table/__snapshots__/table.container.test.js.snap b/src/malcolmWidgets/table/__snapshots__/table.container.test.js.snap index 6fed109f..d00cedd5 100644 --- a/src/malcolmWidgets/table/__snapshots__/table.container.test.js.snap +++ b/src/malcolmWidgets/table/__snapshots__/table.container.test.js.snap @@ -1073,7 +1073,41 @@ exports[`Table container renders correctly 1`] = `
+ + Selected Row: + + +
+
+ + Selected Row: + + +
+
{ props.copyTable(path); } const pad = child => ( -
{child}
+
+ {child} +
); const updateTime = `Update received @ ${new Date( props.attribute.raw.timeStamp.secondsPastEpoch * 1000 ).toISOString()}`; const footerItems = [ ...props.footerItems, + props.attribute.localState && + pad([ + Selected Row:, + ind)} + Value={props.selectedRow} + selectEventHandler={event => { + props.rowClickHandler(path, `row.${event}`); + }} + />, + ]), props.attribute.localState && props.attribute.localState.flags.table.fresh ? pad(Up to date!) : pad({updateTime}), @@ -192,7 +213,7 @@ TableContainer.propTypes = { meta: PropTypes.shape({ writeable: PropTypes.bool, }), - value: PropTypes.shape({}), + value: PropTypes.array, isDirty: PropTypes.bool, flags: PropTypes.shape({ table: PropTypes.shape({ diff --git a/src/malcolmWidgets/table/virtualizedTable.component.js b/src/malcolmWidgets/table/virtualizedTable.component.js index b636bd06..1a1e7a83 100644 --- a/src/malcolmWidgets/table/virtualizedTable.component.js +++ b/src/malcolmWidgets/table/virtualizedTable.component.js @@ -325,7 +325,6 @@ const WidgetTable = props => { rowFlagHandler: mapRowFlagHandler(props.localState, props.setFlag), }; const columnWidgetTags = getTableWidgetTags(tableState.meta); - console.log(JSON.stringify(tableState)); return (
{ return (
(
@@ -462,6 +462,7 @@ WidgetTable.propTypes = { path: PropTypes.string, }), }).isRequired, + selectedRow: PropTypes.number, eventHandler: PropTypes.func.isRequired, closePanelHandler: PropTypes.func.isRequired, rowClickHandler: PropTypes.func.isRequired, @@ -476,6 +477,7 @@ WidgetTable.defaultProps = { localState: undefined, hideInfo: false, showFooter: false, + selectedRow: undefined, addRow: () => {}, };