Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
[focusedRowEnabled]="true"
[focusedRowKey]="cellInfo.value"
[hoverStateEnabled]="true"
(onContextMenuPreparing)="$event.items = []"
(onSelectionChanged)="
onSelectionChanged($event.selectedRowKeys, cellInfo, e.component)
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class AppComponent {
},
});
}

getSelectedRowKeys<T>(value: T): T[] {
return value !== null && value !== undefined ? [value] : [];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const dropDownOptions = { width: 500 };
const ownerLabel = { 'aria-label': 'Owner' };

const EmployeeDropDownBoxComponent = (props) => {
const {data: { value: dataValue }} = props;
const { data: { value: dataValue } } = props;
const initialSelectedRowKeys = dataValue !== null && dataValue !== undefined ? [dataValue] : [];
const [selectedRowKeys, setSelectedRowKeys] = useState(initialSelectedRowKeys);
const [isDropDownOpened, setDropDownOpened] = useState(false);
Expand All @@ -24,6 +24,9 @@ const EmployeeDropDownBoxComponent = (props) => {
}, []);

const contentRender = useCallback(() => {
const onContextMenuPreparing = (event: DataGridTypes.ContextMenuPreparingEvent) => {
event.items = [];
};
const onSelectionChanged = (args: DataGridTypes.SelectionChangedEvent) => {
setSelectedRowKeys(args.selectedRowKeys);
setDropDownOpened(false);
Expand All @@ -38,6 +41,7 @@ const EmployeeDropDownBoxComponent = (props) => {
height={250}
selectedRowKeys={selectedRowKeys}
hoverStateEnabled={true}
onContextMenuPreparing={onContextMenuPreparing}
onSelectionChanged={onSelectionChanged}
focusedRowEnabled={true}
defaultFocusedRowKey={selectedRowKeys[0]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const EmployeeDropDownBoxComponent = (props) => {
}
}, []);
const contentRender = useCallback(() => {
const onContextMenuPreparing = (event) => {
event.items = [];
};
const onSelectionChanged = (args) => {
setSelectedRowKeys(args.selectedRowKeys);
setDropDownOpened(false);
Expand All @@ -31,6 +34,7 @@ const EmployeeDropDownBoxComponent = (props) => {
height={250}
selectedRowKeys={selectedRowKeys}
hoverStateEnabled={true}
onContextMenuPreparing={onContextMenuPreparing}
onSelectionChanged={onSelectionChanged}
focusedRowEnabled={true}
defaultFocusedRowKey={selectedRowKeys[0]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
:height="250"
:selected-row-keys="getSelectedRowKeys(currentValue)"
:hover-state-enabled="true"
:on-context-menu-preparing="onContextMenuPreparing"
:on-selection-changed="onSelectionChanged"
:focused-row-enabled="true"
:focused-row-key="currentValue"
Expand Down Expand Up @@ -61,6 +62,9 @@ function getSelectedRowKeys<T>(value: T | null): T[] {
return value !== null && value !== undefined ? [value] : [];
}

const onContextMenuPreparing = (e: DxDataGridTypes.ContextMenuPreparing) => {
e.items = [];
};
const onSelectionChanged = (e: DxDataGridTypes.SelectionChangedEvent) => {
currentValue.value = e.selectedRowKeys[0];

Expand Down
3 changes: 3 additions & 0 deletions apps/demos/Demos/DataGrid/CustomEditors/jQuery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ $(() => {
selectedRowKeys: selectedRowKeys,
focusedRowEnabled: true,
focusedRowKey: cellInfo.value,
onContextMenuPreparing: (e) => {
e.items = [];
},
onSelectionChanged(selectionChangedArgs) {
e.component.option('value', selectionChangedArgs.selectedRowKeys[0]);
cellInfo.setValue(selectionChangedArgs.selectedRowKeys[0]);
Expand Down
Loading