Skip to content

Commit be5194c

Browse files
author
arturd
committed
Adding "Edit row" option to BrowserCell context menu
1 parent b599bd9 commit be5194c

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

src/components/BrowserCell/BrowserCell.react.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export default class BrowserCell extends Component {
8686
}
8787

8888
getContextMenuOptions(constraints) {
89+
let { onEditSelectedRow } = this.props;
8990
const contextMenuOptions = [];
9091

9192
const setFilterContextMenuOption = this.getSetFilterContextMenuOption(constraints);
@@ -97,6 +98,16 @@ export default class BrowserCell extends Component {
9798
const relatedObjectsContextMenuOption = this.getRelatedObjectsContextMenuOption();
9899
relatedObjectsContextMenuOption && contextMenuOptions.push(relatedObjectsContextMenuOption);
99100

101+
onEditSelectedRow && contextMenuOptions.push({
102+
text: 'Edit row',
103+
callback: () => {
104+
let { onSelect, row, col, objectId, onEditSelectedRow, setCopyableValue } = this.props;
105+
onSelect({ row, col });
106+
setCopyableValue(this.copyableValue);
107+
onEditSelectedRow(true, objectId);
108+
}
109+
});
110+
100111
return contextMenuOptions;
101112
}
102113

@@ -225,8 +236,8 @@ export default class BrowserCell extends Component {
225236
<Pill value={value.id} />
226237
</a>
227238
) : (
228-
value.id
229-
);
239+
value.id
240+
);
230241
this.copyableValue = value.id;
231242
} else if (type === 'Date') {
232243
if (typeof value === 'object' && value.__type) {
@@ -274,8 +285,8 @@ export default class BrowserCell extends Component {
274285
<Pill onClick={() => setRelation(value)} value='View relation' />
275286
</div>
276287
) : (
277-
'Relation'
278-
);
288+
'Relation'
289+
);
279290
this.copyableValue = undefined;
280291
}
281292

src/components/BrowserRow/BrowserRow.react.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default class BrowserRow extends Component {
7777
onPointerClick={onPointerClick}
7878
onFilterChange={onFilterChange}
7979
setRelation={setRelation}
80+
objectId={obj.id}
8081
value={attr}
8182
hidden={hidden}
8283
setCopyableValue={setCopyableValue}

src/dashboard/Data/Browser/Browser.react.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,9 +908,9 @@ class Browser extends DashboardView {
908908
}, 3500);
909909
}
910910

911-
showEditRowDialog(isDoubleClick, objectId) {
911+
showEditRowDialog(selectRow, objectId) {
912912
// objectId is optional param which is used for doubleClick event on objectId BrowserCell
913-
if (isDoubleClick) {
913+
if (selectRow) {
914914
// remove all selected rows and select doubleClicked row
915915
this.setState({ selection: {} });
916916
this.selectRow(objectId, true);

0 commit comments

Comments
 (0)