如何在 react-tabulator 中显示图标?

How can I display an Icon in react-tabulator?

我是制表符的新手,我正在尝试在 React 制表符中将字体超棒的图标添加到列以及旁边写的一些文本(例如 运行停止)。 这是我的代码


    <ReactTabulator
                        ref={ref => (this.ref = ref)}
                        columns= {[
                            {formatter:"rowSelection", titleFormatter:"rowSelection", align:"center", headerSort:false,
                                cellClick:function(e, cell){
                                cell.getRow().toggleSelect();
                                }, width: 30},
                    { title: "Name", field: "name",},
                    { title: "Space", field: "space" },
                    { title: "Service Name", field: "service",  },
                    { title: "Status", field: "status", width: 130, formatter:function(){
                       return <FontAwesome icon={faCircle} color="green/> }},
                    { title: "Last Refreshed", field: "refresh",},
                    ]}

但是没有显示。我得到输出 like this。

您需要导入并使用 reactFormatter 而不是“formatter” 示例:

https://github.com/ngduc/react-tabulator/blob/master/src/ReactTabulatorExample.tsx#L23