Ag Grid单元格渲染器图标不可点击

编程入门 行业动态 更新时间:2024-10-10 02:19:00
本文介绍了Ag Grid单元格渲染器图标不可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个简单的单元格渲染器,它返回一个图标:

I have a simple cell renderer that returns an icon:

import React from 'react' function ActionRenderer(params) { const editRedirect = (e) =>{ console.log("Clicked"); } return ( <div> <span class="actionIcons editIcon"> <i onClick={editRedirect} class="fas fa-edit" href="/details"></i> </span> </div> ) } export default ActionRenderer

创建AgGrid组件时,我还定义了一个 onRowClicked 事件.

When I create my AgGrid component, I also defined a onRowClicked event.

<AgGridReact columnDefs={columnDefs} defaultColDef={{ width: 160 }} rowData={rowData} frameworkComponents={frameworkComponents} onRowClicked={rowClicked} ></AgGridReact>

因此,我的图标不可单击,但它们下面的行是可单击的.如何使图标可单击,但是如果在图标外部单击一行,则会运行 rowClicked 函数?换句话说,行点击将覆盖我的图标点击,而我是要更改它.

As a result, my icons are not clickable, but the row below them is. How do I make it so that the icons are clickable, but if a row is clicked outside of the icons, then the rowClicked function runs? In other words, the row click is overriding my icon click, and I was to change that.

const frameworkComponents = { // buttonRenderer: ButtonRenderer, progressBarRenderer: ProgressBarRenderer, actionRenderer: ActionRenderer, } const columnDefs = [ { headerName: 'Full Name', field: 'name', unSortIcon: true, sortable: true, filter: true, lockPosition: true, }, { headerName: 'Actions', field: 'actions', width: 140, lockPosition: true, cellRenderer: 'actionRenderer', }, ]

推荐答案

尝试使用按钮标签代替按钮中的跨度和图标,您可以使用css删除背景.

Try using button tag instead for span and icon inside button you can remove background using css.

更多推荐

Ag Grid单元格渲染器图标不可点击

本文发布于:2023-11-23 00:42:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619505.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单元格   图标   渲染器   Ag   Grid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!