简体   繁体   English

如何使用 [React+Typescript] 在 Table 上实现上下文菜单

[英]How to implement context menus on Table Using [React+Typescript]

Using [React+Typescript] I need to implement context menus on Table [on click on row cell and column header].使用 [React+Typescript] 我需要在表上实现上下文菜单 [单击行单元格和列标题]。

Looked several libraries: ag grid provides context menus in enterprise version, that to on rows cell only.查看了几个库:ag grid 在企业版中提供上下文菜单,仅在行单元格上。 react-data-grid provides row level context menus. react-data-grid 提供行级上下文菜单。 but this lib is having poor doc maintenance,it makes difficult to develop但是这个库的文档维护很差,很难开发

can any on please suggest how I can achieve this?任何人都可以建议我如何实现这一目标吗?

You can actually achieve what you are looking for with AG-Grid (even without the enterprise version).您实际上可以使用 AG-Grid(即使没有企业版)实现您正在寻找的东西。

We are currently using AG-Grid (free version) for our Tables and it has the possibility to display context menus as you are able to write your own cell renderer functions with AG-Grid.我们目前正在为我们的表格使用 AG-Grid(免费版),它可以显示上下文菜单,因为您可以使用 AG-Grid 编写自己的单元格渲染器功能。 (Column renderer functions respectively). (列渲染器功能分别)。 These Cell renderers can be written in both React or plain Javascript.这些 Cell 渲染器可以用 React 或普通的 Javascript 编写。

If you write the Cell Renderer yourself you are in full control of what happens on interaction with any given cell.如果您自己编写 Cell Renderer,您可以完全控制与任何给定单元格交互时发生的情况。

You can even implement more complex Cell renderers that interact with the user in various ways.您甚至可以实现以各种方式与用户交互的更复杂的 Cell 渲染器。

Here is a link to read more: https://www.ag-grid.com/javascript-grid-cell-rendering-components/这是阅读更多信息的链接: https://www.ag-grid.com/javascript-grid-cell-rendering-components/

Hope this helps.希望这可以帮助。

Disclaimer: I am not in any way affiliated with AG-Grid or its developers.免责声明:我与 AG-Grid 或其开发人员没有任何关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM