diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/CollectionNoteTakingViewFieldColumn.tsx | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/src/client/views/collections/CollectionNoteTakingViewFieldColumn.tsx b/src/client/views/collections/CollectionNoteTakingViewFieldColumn.tsx index ae0729111..108fed6b7 100644 --- a/src/client/views/collections/CollectionNoteTakingViewFieldColumn.tsx +++ b/src/client/views/collections/CollectionNoteTakingViewFieldColumn.tsx @@ -136,9 +136,16 @@ export class CollectionNoteTakingViewFieldColumn extends React.Component<CSVFiel @action deleteColumn = () => { - this.props.docList.forEach(d => d[this.props.pivotField] = undefined); + // this.props.docList.forEach(d => d[this.props.pivotField] = undefined); if (this.props.columnHeaders && this.props.headingObject) { const index = this.props.columnHeaders.indexOf(this.props.headingObject); + if (index > 0) { + const newHeader = this.props.columnHeaders[index - 1]; + this.props.docList.forEach(d => d[this.props.pivotField] = newHeader.heading.toString()) + } else { + // 1 exists because that ensures that we have at least one column (and not the buggy 0 one) + this.props.docList.forEach(d => d[this.props.pivotField] = "1"); + } this.props.columnHeaders.splice(index, 1); } } @@ -297,30 +304,30 @@ export class CollectionNoteTakingViewFieldColumn extends React.Component<CSVFiel }}> {this.props.renderChildren(this.props.docList)} </div> - + {!this.props.chromeHidden && type !== DocumentType.PRES ? - <div className="collectionNoteTakingView-DocumentButtons" - style={{ width: this.props.columnWidth / this.props.numGroupColumns, marginBottom: 10 }}> - <div key={`${heading}-add-document`} className="collectionNoteTakingView-addDocumentButton"> - <EditableView - GetValue={returnEmptyString} - SetValue={this.addNewTextDoc} - textCallback={this.textCallback} - placeholder={"Type ':' for commands"} - contents={"+ New Node"} - toggle={this.toggleVisibility} - menuCallback={this.menuCallback} - /> - </div> - <div key={`${this.props.Document[Id]}-addGroup`} className="collectionNoteTakingView-addDocumentButton"> - <EditableView {...this.props.editableViewProps} /> - </div> - <button className="collectionStackingView-sectionDelete" onClick={this.deleteColumn}> - <FontAwesomeIcon icon="trash" size="lg" /> - </button> + <div className="collectionNoteTakingView-DocumentButtons" + style={{ width: this.props.columnWidth / this.props.numGroupColumns, marginBottom: 10 }}> + <div key={`${heading}-add-document`} className="collectionNoteTakingView-addDocumentButton"> + <EditableView + GetValue={returnEmptyString} + SetValue={this.addNewTextDoc} + textCallback={this.textCallback} + placeholder={"Type ':' for commands"} + contents={"+ New Node"} + toggle={this.toggleVisibility} + menuCallback={this.menuCallback} + /> + </div> + <div key={`${this.props.Document[Id]}-addGroup`} className="collectionNoteTakingView-addDocumentButton"> + <EditableView {...this.props.editableViewProps} /> + </div> + <button className="collectionStackingView-sectionDelete" onClick={this.deleteColumn}> + <FontAwesomeIcon icon="trash" size="lg" /> + </button> </div> - : null} - + : null} + </div> } </>; |