Changeset:
c02f6d138bd5
https://sourceforge.net/p/mrbs/hg-code/ci/c02f6d138bd553baf06bbb26bec5e444208ae629
Author:
Campbell Morrison <[email protected]>
Date:
Fri Oct 02 15:44:41 2015 +0100
Log message:
Column visibility working with pending.php
diffstat:
web/js/datatables.js.php | 36 ++++++++++++++++++++++--------------
web/js/pending.js.php | 12 ++++++++++--
2 files changed, 32 insertions(+), 16 deletions(-)
diffs (87 lines):
diff -r e8c8086e45fe -r c02f6d138bd5 web/js/datatables.js.php
--- a/web/js/datatables.js.php Fri Oct 02 15:05:29 2015 +0100
+++ b/web/js/datatables.js.php Fri Oct 02 15:44:41 2015 +0100
@@ -125,32 +125,40 @@
<?php
// Construct the set of columns to be included in the column visibility
- // button. Exclude any fixed columns.
+ // button. If specificOptions is set then use that. Otherwise include
+ // all columns except any fixed columns.
?>
- colVisIncludeCols = [];
- nCols = table.find('tr:first-child th').length;
- for (i=0; i<nCols; i++)
+ if (specificOptions &&
+ specificOptions.buttons)
{
- if (fixedColumnsOptions)
+ defaultOptions.buttons = specificOptions.buttons;
+ }
+ else
+ {
+ colVisIncludeCols = [];
+ nCols = table.find('tr:first-child th').length;
+ for (i=0; i<nCols; i++)
{
- if (fixedColumnsOptions.leftColumns && (i <
fixedColumnsOptions.leftColumns))
+ if (fixedColumnsOptions)
{
- continue;
+ if (fixedColumnsOptions.leftColumns && (i <
fixedColumnsOptions.leftColumns))
+ {
+ continue;
+ }
+ if (fixedColumnsOptions.rightColumns && (i >=
nCols-fixedColumnsOptions.rightColumns))
+ {
+ continue;
+ }
}
- if (fixedColumnsOptions.rightColumns && (i >=
nCols-fixedColumnsOptions.rightColumns))
- {
- continue;
- }
+ colVisIncludeCols.push(i);
}
- colVisIncludeCols.push(i);
+ defaultOptions.buttons[0].columns = colVisIncludeCols;
}
- defaultOptions.buttons[0].columns = colVisIncludeCols;
<?php
// Merge the specific options with the default options. We do a deep
// merge.
?>
mergedOptions = $.extend(true, {}, defaultOptions, specificOptions);
-
dataTable = table.DataTable(mergedOptions);
if (fixedColumnsOptions)
diff -r e8c8086e45fe -r c02f6d138bd5 web/js/pending.js.php
--- a/web/js/pending.js.php Fri Oct 02 15:05:29 2015 +0100
+++ b/web/js/pending.js.php Fri Oct 02 15:44:41 2015 +0100
@@ -41,7 +41,9 @@
subtables,
startTimeCol = maintable.find('thead tr:first
th.header_start_time').index(),
tableOptions,
- pendingDataTable;
+ pendingDataTable,
+ i,
+ colVisIncludeCols;
<?php
// Add a '-' control to the subtables and make them close on clicking it
@@ -122,7 +124,13 @@
// Remove the first column from the column visibility
// list because it is the control column
?>
- tableOptions.colVis = {exclude: [0]};
+ colVisIncludeCols = [];
+ for (i=1; i<maintable.find('thead tr:first th').length; i++)
+ {
+ colVisIncludeCols.push(i);
+ }
+ tableOptions.buttons = [{extend: 'colvis',
+ columns: colVisIncludeCols}];
<?php
// and stop the first column being reordered
?>
------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits