Skip to content

Events customisation for the grid cell

Compare
Choose a tag to compare
@komarovalexander komarovalexander released this 12 Jan 10:25
· 1222 commits to master since this release
83e5f9d

childAttributes prop was added for grid cell events customisation

Demo: Events

const childAttributes: ChildAttributes = {
  cell: {
    className: '123',
    onClick: (e, extendedEvent): any => {
      const { childProps: { dispatch } } = extendedEvent;
      dispatch('MY_CELL_onClick', { extendedEvent });
    },
    onContextMenu: (e, extendedEvent) => {
      extendedEvent.dispatch('MY_CELL_onContextMenu', { extendedEvent });
    },
    onDoubleClick: (e, extendedEvent) => {
      const { dispatch, childElementAttributes } = extendedEvent;
      childElementAttributes.onClick?.(e);
      dispatch('MY_CELL_onDoubleClick', { extendedEvent });
    },
  },
};

return <Table ... childAttributes={childAttributes}>