Reference mData by name not number

Reference mData by name not number

edarrienedarrien Posts: 2Questions: 1Answers: 0

Hello
I have the following Ajax request that I would like to be able to reference columns by column name not by number.
Here is my aColumns:

$aColumns = array( 'id','name','Amount','Date');

My Ajax request:

 "aaSorting": [[0, 'asc']],
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": "../includes/functions/requests_json.php",
            "fnServerParams": function ( aoData ) {
                            aoData.push( {"name": "account_id", "value": acct_id} );
                          },
        "aoColumns": [
        { "mData": "0" },
        { "mData": "1" },
        { "mData": "2" },
        { "mData": "3" },
],

I would like to be request columns to view in the table in this manner:

"aoColumns": [
        { "mData": "id" },
        { "mData": "name" },
        { "mData": "Amount" },
        { "mData": "Date" },
],

Here is my column in the PHP section:

$aColumns = array( 'id','name','Amount','Date');

Here is how my JSON looks like:

[aaData] => Array
        (
            [0] => Array
                (
                    [0] => 12
                    [1] => Test Account
                    [2] => 38
                    [3] => 03/21/2015 )

Any input is appreciated.

This discussion has been closed.