Ag-Grid Row Extension

Im using Ag-grid to manage my table, but I want the row list to be stored in my group instead of making the row group expandable in 2 clicks, I want to be a single click. If I click on the arrow of the icon, it works, but if I click on the title bar, it will open only 2 clicks.

I already tried to find any information about this in the documentation, but I can not find anything.

Here is an example from the documentation. https://ag-grid.com/javascript-grid-tree/index.php

Image example: enter image description here

+7
source share
4 answers

You can listen to events either by line or by cell, and expand nodes accordingly.

, , :

onRowClicked: (params) => {
    // update the node to be expanded
    params.node.expanded = true; 
    // tell the grid to redraw based on state of nodes expanded state 
    gridOptions.api.onGroupExpandedOrCollapsed(params.rowIndex)
}

- , .

+6

onGroupExpandedOrCollapsed, ...

, onGroupExpandedOrCollapsed.

onRowClicked(params) {
    params.node.setExpanded(!params.node.expanded);
}

, params.node.setExpanded(true), , .

+2

In a column definition, you can use a function onCellClicked(params)to tell it to do something when you click a cell. I tried looking for an extension function, but I could only find expandAll()that I do not think you want. So I would just use jQuery or a simple DOM selection to click the extension icon inside this cell.

+1
source

this one works

 onRowClicked(params) { 
    params.context.setExpand.onExpandClicked(params.rowIndex, params.node.rowHeight);
  }
0
source

Source: https://habr.com/ru/post/1657974/


All Articles