无法在 bootstrap bootgrid 中打印子 table 值
Not able to print the child table values in bootstarap bootgrid
JSON 响应:
{
"current": 1,
"rowCount": 10,
"rows": [
{
"id": 19,
"sender": "123@test.de",
"received":"[
{
"name":"received1"
}
]
}
]
},
{
"id": 14,
"sender": "123@test.de",
"received": [
{
"name":"received2"
}
]
},
...],
"total": 1123}
我想使用 bootgrid 打印收到的名称。
示例:
<th data-column-id="id" data-identifier="true">Id</th>
<th data-column-id="received.name">Name</th>
我可以打印 received.name
,但无法打印 id
。
对于上述问题,我们必须在 bootstrap bootgrid 中使用数据格式化程序。
我已将代码附在此处,希望对您有所帮助。
<script> $("#MyTable").bootgrid({
ajax: true,formatters: {
"link": function (column, row)
{
return "<span>" + row.received.name+ "</span>";
}
}});
</script>
你的 Html 会喜欢
<table>
<th data-column-id="received.name" data-formatter="link">Anything</th>
</table>
{
"current": 1,
"rowCount": 10,
"total": 123
"rows": [
{
"id": 19,
"sender": "123@test.de",
"received":"received1"
},
{
"id": 20,
"sender": "123@testasdasd.de",
"received":"receisaddved1"
}
]
}
// 这是填充网格的方法我的朋友。
JSON 响应:
{
"current": 1,
"rowCount": 10,
"rows": [
{
"id": 19,
"sender": "123@test.de",
"received":"[
{
"name":"received1"
}
]
}
]
},
{
"id": 14,
"sender": "123@test.de",
"received": [
{
"name":"received2"
}
]
},
...],
"total": 1123}
我想使用 bootgrid 打印收到的名称。
示例:
<th data-column-id="id" data-identifier="true">Id</th>
<th data-column-id="received.name">Name</th>
我可以打印 received.name
,但无法打印 id
。
对于上述问题,我们必须在 bootstrap bootgrid 中使用数据格式化程序。
我已将代码附在此处,希望对您有所帮助。
<script> $("#MyTable").bootgrid({
ajax: true,formatters: {
"link": function (column, row)
{
return "<span>" + row.received.name+ "</span>";
}
}});
</script>
你的 Html 会喜欢
<table>
<th data-column-id="received.name" data-formatter="link">Anything</th>
</table>
{
"current": 1,
"rowCount": 10,
"total": 123
"rows": [
{
"id": 19,
"sender": "123@test.de",
"received":"received1"
},
{
"id": 20,
"sender": "123@testasdasd.de",
"received":"receisaddved1"
}
]
}
// 这是填充网格的方法我的朋友。