twitter-bootstrap - Bootstrap 表中的多个数据字段

标签 twitter-bootstrap bootstrap-table

在我的数据库中,我有字段 fname 和 lname。我正在使用 Bootstrap 表向用户显示结果。我想做的是连接两个字段以显示在一列名为 Name 的下方。

这目前有效,尽管名字和姓氏在不同的列中。我想将它们合并到同一列中。

<th data-field="fname">First Name</th>
<th data-field="lname">Last Name</th>
<th data-field="title">Title</th>
<th data-field="position">Position</th>
<th data-field="cell">Cell</th>
<th data-field="home">Home</th>
<th data-field="workgroup">Workgroup</th>

我搜索了文档,但没有看到任何示例。
谢谢!

最佳答案

或许可以试试 http://bootstrap-table.wenzhixin.net.cn/documentation/ 的列部分中的“数据格式化程序”。 ?

模板:

<table>
<th data-field="firstname"
    data-formatter="nameFormatter"></th>
</table>

的JavaScript:
function nameFormatter(value, row, index) {
    return value + " " + row.lastname;
}

关于twitter-bootstrap - Bootstrap 表中的多个数据字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43825152/

相关文章:

twitter-bootstrap - 出现水平滚动条,行有负边距

javascript - 将此多级 Bootstrap 4 下拉克隆克隆到 mimc btn-dark 样式时遇到问题

jquery - Bootstrap : TypeError: $(. ..).modal 不是函数

javascript - Bootstrap 表显示空行

javascript - 不使用jquery在click中获取bootstrap表的行索引

javascript - Bootstrap Table - 根据 Cell 内的值将类添加到 Row

css - 自举网格列之间的长间隙

css - Bootstrap Popover - 在任何地方点击关闭

javascript - Bootstrap 表 "item per page"下拉列表不工作

html - 引导表 : how to vertical align the detail-icon?