【问题标题】:ag-Grid Cell data value?ag-Grid 单元格数据值?
【发布时间】:2020-10-11 17:15:52
【问题描述】:

使用 Ag-Grid 并尝试在用户单击单元格时设置事件我想获取其数据值。

我的控制台正在打印:>{rowIndex:4, rowPinned: null, column: t}

我有一个 10.50 的值,正在尝试检索它。

根本不工作请指教...

var gridOptions = {
      columnDefs: columnDefs,
      rowData: rowData,
      onCellClicked: function(event) { 
          
          
        var focusedCell=gridOptions.api.getFocusedCell()
        
        
        console.log(focusedCell)  
          
          
          },
      
      suppressMovableColumns:true,
      
    };

【问题讨论】:

  • console(event) 首先,它可能包含行数据或某种id。

标签: ag-grid


【解决方案1】:

您只需要执行event.value 即可检索单击单元格的值

const cellValue = event.value;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-21
    • 2021-01-27
    • 1970-01-01
    • 1970-01-01
    • 2019-09-06
    • 2023-03-18
    • 2018-12-25
    • 2019-07-29
    相关资源
    最近更新 更多