aTargets and mData column names
aTargets and mData column names
I've got a table which uses mData to set the names of the columns for pulling the data from the json stream:
[code]
{ "mData": "id", "aTargets": [0] },
{ "mData": "name", "aTargets": [1] },
...
[/code]
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
[code]
{ "mData": "id", "aTargets": [0] },
{ "mData": "name", "aTargets": [1] },
...
[/code]
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
This discussion has been closed.
Replies
Is that what you are looking for?
Allan
thanks!
-steve j
As a side note, would there be any interest in a generic Perl back-end for server side processing that relies on mDataProp and that uses DBIx::Class for the database interaction? My code has a ton of customization beyond that, but I think it would be a cool exercise to pull out the generic parts into a separate module.
thanks!
-steve j
Allan