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

aTargets and mData column names

$
0
0
I've got a table which uses mData to set the names of the columns for pulling the data from the json stream:

      { "mData": "id", "aTargets": [0] },
      { "mData": "name", "aTargets": [1] },
      ...

This works great. There are a number of other things I'm doing in with "aoColumnDefs", including setting visibility, mRenders, sortables, etc... For each of those other items, I still need to refer to the data items by position, i.e. with "aTargets[0]". I can't use the TH for this column in particular since I'm using a checkbox for the column heading. Also, for other columns, I'd rather not use the TH, since the TH doesn't always match the column name. i.e. TH could be "System Name" and the column name within the data could just be "name".

Is there any way to use the column names from within the data for aTargets? I'd like to be able to re-order the columns without needing to go back through and check all of the aTargets.

Thanks!

-steve j

Viewing all articles
Browse latest Browse all 81688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>