Is it possible to omit certain columns from aTargets or set a range of columns
Is it possible to omit certain columns from aTargets or set a range of columns
pssguy
Posts: 1Questions: 0Answers: 0
Hi,
New to DataTables and using it in rCharts which has different syntax so bear with me
I have a table will which will have a varying number of columns. I want to apply a function to all but the first column.
So if the number of columns is len then "aTargets": [1,2,3...len] is what I want to pass. It does not appear that something like 1:len works
and -0 is equivalent of 0
Or failing that, can I refer to column 0 somehow in my function and exclude it with a !=
cheers
New to DataTables and using it in rCharts which has different syntax so bear with me
I have a table will which will have a varying number of columns. I want to apply a function to all but the first column.
So if the number of columns is len then "aTargets": [1,2,3...len] is what I want to pass. It does not appear that something like 1:len works
and -0 is equivalent of 0
Or failing that, can I refer to column 0 somehow in my function and exclude it with a !=
cheers
This discussion has been closed.
Replies
[code]
..., "aTargets": [
<?php
// $len is the total number of columns that you have
for ($i = 1; $i < $len; $i++) {
if ($i == $len - 1) {
echo $i;
} else {
echo $i . ', ';
}
}
?>
], ...
[/code]
Here is the code for excluding the last column
[code]
..., "aTargets": [
<?php
// $len is the total number of columns that you have
for ($i = 0; $i < $len - 1; $i++) {
if ($i == $len - 2) {
echo $i;
} else {
echo $i . ', ';
}
}
?>
], ...
[/code]
I haven't tested this out, so it may not work. But it should be close if it isn't right
Allan