Ag-Grid展开行 [英] Ag-Grid expand row

查看:627
本文介绍了Ag-Grid展开行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ag-grid来控制我的表,但是我希望在存储行列表的组中而不是使行组在2次单击中扩展,我希望在1次单击。
如果我单击图标箭头,它会起作用,但是如果我单击标题行,它只会在2次单击后打开。



我已经尝试在其中查找文档中有关于它的任何信息,但是什么也找不到。



这里是文档中的一个示例。

解决方案

您可以监听单击的行或单元格上的事件,并相应地展开节点。



例如,根据点击展开一行,您可以执行以下操作:

  onRowClicked:(params)=> {
//更新要扩展的节点
params.node.expanded = true;
//通知网格根据节点状态重新绘制扩展状态
gridOptions.api.onGroupExpandedOrCollapsed(params.rowIndex)
}

这应该在文档中-我将对其进行更新以反映此信息。


Im using Ag-grid to control my table, but i want in my group that stores a list of rows instead of having to make the row group expand in 2 clicks, i want to be on 1 click. If i click on the icon arrow it works, but if i click on the title row it only opens on 2 clicks.

I already tried to find in the documentation any information about it, but cant find nothing.

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

example image:

解决方案

You can listen to events on either a row or cell clicked, and expand nodes accordingly.

For example to expand a row based on a click you could do the following:

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)
}

This should be in the documentation - I'll update it to reflect this information.

这篇关于Ag-Grid展开行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆