-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.

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
vinodh
  • 714
  • 1
  • 7
  • 20

2 Answers2

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

// This is the way to populate the grid my friend.

Musakkhir Sayyed
  • 7,012
  • 13
  • 42
  • 65
-1

For the above issue we have to use data-formatter in bootstrap bootgrid.

i have attached the code here, hope it will helpful.

<script>  $("#MyTable").bootgrid({
            ajax: true,formatters: {
                "link": function (column, row) 
                {
                    return "<span>" + row.received.name+ "</span>";
                }
            }}); 
</script>

Your Html will like

 <table>
 <th data-column-id="received.name" data-formatter="link">Anything</th> 
 </table>
vinodh
  • 714
  • 1
  • 7
  • 20