Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82017

mDataProp

$
0
0
I'm apparently misunderstanding the use of mDataProp and how to actually map the fields. What I want to be able to do is to simply add a new field to the getdata.php file and be able to simply add the mapping in the initialization script.

Here's a small example of how I've mapped the fields:
                    {"mDataProp":  "TERM"},                                     // TERM
                    {"mDataProp":  "TERM_START"},                               // TERM_START
                    {"mDataProp":  "TERM_END"},                                 // TERM_END
                    {"mDataProp":  "CKT_SOURCE", "bVisible":    false}         // CKT_SOURCE

Here is my .columnfilter code:
                    {   type: "select",
                        values: [ <? echo generateSearchOptions("", "CIRCUIT_DATA", "TERM"); ?> ] },  // TERM
                    {   },  // TERM_START
                    {   },  // TERM_END
                    {   }  // CKT_SOURCE

My json is returning as (this is just a snippet):
{
    "sEcho": 6,
    "iTotalRecords": 21506,
    "iTotalDisplayRecords": 21506,
    "aaData": [{
                "TERM": "TERM",
                "TERM_START": "TERM_START",
                "TERM_END": "TERM_END",
                "CKT_SOURCE": "CKT_SOURCE"
        }]
}

In reading I saw that I have to take my mapping into account some how in the server side script. I wasn't able to find anything on HOW to do this.

My goal is to be able to simply add/remove/edit the table headers, the mDataProp fields, and .columnFilter code without having to wrangle with the server-side data script.

Currently, if I want to move a column from the end of the list to the beginning and only edit it in the initialization, the filters break. As soon as I go to the server-side script and update the order there, everything works fine again.

Any help is appreciated.

Thanks,


Trevor

Viewing all articles
Browse latest Browse all 82017

Trending Articles