-2

JSON response:

{
    "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}

I want to print the received name using bootgrid.

Example:

<th data-column-id="id" data-identifier="true">Id</th>
<th data-column-id="received.name">Name</th>

I am able to print received.name, but not able to print id.

4

2 回答 2

0
{
    "current": 1,
    "rowCount": 10,
"total": 123
    "rows": [
        {
            "id": 19,
            "sender": "123@test.de",
            "received":"received1"
        },
{
            "id": 20,
            "sender": "123@testasdasd.de",
            "received":"receisaddved1"
        }
]
}

// 这是填充网格的方法我的朋友。

于 2016-02-16T05:06:41.280 回答
-1

对于上述问题,我们必须在 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>
于 2015-07-28T11:09:45.940 回答