简体   繁体   English

函数中的引用字段值

[英]Reference Field Value In Function

I have generated a Tabulator table via JavaScript.我已经通过 JavaScript 生成了一个 Tabulator 表。 I have a column that is displaying a download icon and has a cellClick event.我有一列显示下载图标并有一个cellClick事件。 In the cellClick event I am calling a custom function and wish to pass the function the value of a field that is displayed in another column.cellClick事件中,我正在调用一个自定义函数,并希望将另一个列中显示的字段的值传递给该函数。 I'm having difficulty determining how to reference the field value in the other column to pass to my function.我很难确定如何引用另一列中的字段值以传递给我的函数。

The column with the download icon is coded as:带有下载图标的列编码为:

Note: the downloadIcon is being generated with a function to display a Font Awesome icon.注意:正在生成的 downloadIcon 带有显示 Font Awesome 图标的功能。

{formatter: downloadIcon, width: 50, align: 'center', cellClick:function(e, cell){fileDownload(pdfURI);}}

The pdfURI that I wish to pass to the fileDownload function is a field in my table and is displayed in another column.pdfURI,我希望传递给fileDownload功能在我的表中的字段,并显示在另一列。

You can call the getData function on the Cell Component passed into the click callback, This will return the data object for the row.您可以在传递给单击回调的单元格组件上调用getData函数,这将返回该行的数据对象。

{formatter: downloadIcon, width: 50, align: 'center', cellClick:function(e, cell){
    fileDownload(cell.getData().pdfURI);
}}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM