制表符-如何在格式化程序中创建多行文本:“链接”

问题描述 投票:0回答:1

我使用http://tabulator.info,并希望在表格单元格中具有html链接。我使用formatter:“ link”,一切正常:

{title:“ Reference”,field:“ ref”,headerSort:false,formatter:“ link”,variableHeight:true,formatterParams:{labelField:“ name”,target:“ _ blank”,urlField:“ link”, urlPrefix:“ articles /”},宽度:“ 185”},

但是labelField中的文本不是多行的,例如formatter:“ textarea”可能的。html链接是否可以包含多行文字?

谢谢,瓦迪姆

tabulator
1个回答
0
投票

我已经成功地使用Custom Formaters创建多行行。要点是,当数据进入表时,将调用自定义格式化程序,并将单元格作为参数传递。您可以从其中(cell.getValue())中提取单元格数据并根据需要进行操作。至少这就是我根据包含的数据将Font Awesome图标添加到各行的目的。我使用Handlebars格式化HTML代码段,并在调用自定义格式化程序功能时返回该代码段

无论如何,不​​确定我是否知道您需要做什么,但这也许会有所帮助。


let eventTableItemMediaScript = `
<div>{{eventTitle}}</div>
<div class="d-flex justify-content-between mr-1">
<small>
{{eventDate}}
</small>
<i class="{{iconName}}" style="color:{{iconColor}}"></i>
</div>
`
let eventTableItemMediaTemplate = Handlebars.compile(eventTableItemMediaScript);

enter image description here


来自文档

{title:"Name", field:"name", formatter:function(cell, formatterParams, onRendered){
    //cell - the cell component
    //formatterParams - parameters set for the column
    //onRendered - function to call when the formatter has been rendered

    return "Mr" + cell.getValue(); //return the contents of the cell;
    },
}
© www.soinside.com 2019 - 2024. All rights reserved.