Quantcast
Channel: DataTables 1.10 — DataTables forums
Viewing all articles
Browse latest Browse all 2364

Pass additional meta data to javascript array

$
0
0

Hi,
I need to pass some additional data to datatable through a javascript array.
This would be my data array to be passed to dt:

datiTabella = array(
    'dati' => array(
        0 => array(
            'id' => '1'
        ),
        1 => array(
            'id' => '2'
        )
    ),
    'schema' => array(
        0 => array(
            'nomeCampo' => 'id',
            'relazione' => 'incarico.idAssicurato'
        )
    )
);

'dati' contains database data
'schema' contains database fields metadata, to be used in a function

In every column i need to access both 'dati' (to be displayed) and 'schema' to be used in a function, but how to access that keys?

"data": datiTabella,
"columns": [
    {
        // THIS IS THE 'ACTION' COLUMN: it contains links related to the data row and that links should depend on data in 'schema' key
        "data":           null,
        "render": function(data, type, row, meta) {
             // HERE I NEED TO ACCESS 'schema' key to output functional buttons
        }
    },
    {
        "data": // HERE I NEED TO ACCESS 'dati' key
    }
]

Could someone help?
Thank you

Alex


Viewing all articles
Browse latest Browse all 2364

Trending Articles