Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(editors): use better Cell Menu option name activateCellOnMenuClick #1593

Merged
merged 1 commit into from
Jul 3, 2024
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 @@ -482,7 +482,7 @@ export default class Example12 {
// when using the cellMenu, you can change some of the default options and all use some of the callback methods
enableCellMenu: true,
cellMenu: {
preventEventBubbling: false
activateCellOnMenuClick: true, // this is important to know which row index to use for Composite Editor
},
gridMenu: {
hideToggleDarkModeCommand: false, // disabled command by default
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/extensions/slickCellMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class SlickCellMenu extends MenuFromCellBaseClass<CellMenu> {
const columnDef = this.grid.getColumns()[cell.cell];

// prevent event from bubbling but only on column that has a cell menu defined
if (columnDef?.cellMenu && this.gridOptions.cellMenu?.preventEventBubbling !== false) {
if (columnDef?.cellMenu && !this.gridOptions.cellMenu?.activateCellOnMenuClick) {
event.preventDefault();
}

Expand Down
7 changes: 5 additions & 2 deletions packages/common/src/interfaces/cellMenuOption.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ export interface CellMenuOption {
/** Same as "optionTitle", except that it's a translation key which can be used on page load and/or when switching locale */
optionTitleKey?: string;

/** By default event bubbling will be prevented but in some cases we want the events to be bubbling (e.g. Cell Menu with Composite Editor not receiving active cell/row) */
preventEventBubbling?: boolean;
/**
* Defaults to False, do we want to change the active cell when clicking the Cell Menu,
* typically we don't but for Cell Menu with Composite Editor we need to know the row index and for that we need to change active cell
*/
activateCellOnMenuClick?: boolean;

/** Defaults to True, should we show bullets when icons are missing? */
showBulletWhenIconMissing?: boolean;
Expand Down
Loading