Table import json data without headers

Get help with using Metro 4 components
Post Reply
Posts: 1
Joined: Fri Jul 19, 2019 4:22 am
Status: Offline

Table import json data without headers

Post by rodrigofarias » Fri Jul 19, 2019 5:16 am

I am trying to generate a table from a json object, using the data-source attribute.

However, unfortunately I do not have the authority to manipulate the way the json object is generated on the back-end server, and it always comes with a simple array. The format required by the Metro table component {data: [ ], header: [ ]} could only be created in the front-end.

I have tried interrupting data loading in the data-loaded event, but, of course, it does not work:

Code: Select all

<table class="table striped"
    data-on-data-loaded = "alCargarPlanillas"
function alCargarPlanillas(source, response){
    var myHeader = [
            "name": "id",
            "title": "ID",
            "show": false,
            "format": "number"
            "name": "mes",
            "title": "Mes",
            "format": "number",
            "name": "monto",
            "title": "Monto Total",
            "format": "money",

    var myData = response;    // json object array from back-end [{id:1, mes: 8, monto: 10000}, {...}, {...}]
    response = {"data": myData, "header": myHeader};
Is there a way to achieve this?

User avatar
Site Admin
Posts: 225
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Tue Jul 30, 2019 8:28 pm

create table header in your html page, and import data without header part

Post Reply