[英]Make ag-grid row selectable without a checkbox
I am trying to make a row selectable in ag-grid without a checkbox.我正在尝试在没有复选框的情况下在 ag-grid 中选择一行。 I don't want to use a checkbox as is described here but I'll do that if I have to so I can get it to work.
我不想使用此处描述的复选框,但如果必须,我会这样做,这样我就可以让它工作。 Right now I've got the checkbox select callback working.
现在我有复选框 select 回调工作。 Is there another way for ag-grid to capture the event of clicking anywhere on the row so I can get rid of the extra "select" column?
是否有另一种方法让 ag-grid 捕获单击行上任意位置的事件,以便我可以摆脱额外的“选择”列? I'm not seeing anything in the documentation.
我在文档中没有看到任何内容。
Right now this is my column definition现在这是我的列定义
export const labelMap = [
{
headerName: 'Select',
headerTooltip: 'Select',
field: 'select',
width: myColWidth,
sortable: false,
filter: false,
checkboxSelection: true,
},
{
headerName: 'Id',
headerTooltip: 'Id',
field: 'id',
width: myColWidth,
sortable: true,
filter: true,
},
But the "select" column does not have a checkbox and my ag-grid但是“选择”列没有复选框和我的 ag-grid
<AgGridReact
columnDefs={columnDefs}
rowData={rowData}
onGridReady={onGridReady}
rowDataChangeDetectionStrategy="IdentityCheck"
defaultColDef={defaultColumnDef}
columnTypes={columnTypes}
rowSelection="multiple"
onSelectionChanged={onSelectionChanged}
onRowSelected={onRowSelected}
enableCellTextSelection
suppressRowClickSelection="true"
isRowSelectable={isRowSelectable}
getRowNodeId={getRowNodeId}
onRowDataChanged={onRowDataChanged}
onFilterChanged={onFilterChanged}
onSortChanged={onSortChanged}
onFirstDataRendered={onFirstDataRendered}
{...gridProps}
/>
Remove suppressRowClickSelection={true}
and you should be good.删除
suppressRowClickSelection={true}
,你应该会很好。 Taking from the ag-grid docs :取自ag-grid 文档:
suppressRowClickSelection
: If true, rows won't be selected when clicked.suppressRowClickSelection
:如果为 true,则单击时不会选择行。 Use, for example, when you want checkbox selection, and don't want to also select the row when the row is clicked.例如,当您想要选择复选框,并且不想在单击行时也 select 时使用该行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.