update bower version and dependencies
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "datatables-responsive",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.5",
|
||||
"main": [
|
||||
"js/dataTables.responsive.js",
|
||||
"css/dataTables.responsive.css"
|
||||
@@ -10,14 +10,13 @@
|
||||
"datatables": ">=1.10.1"
|
||||
},
|
||||
"homepage": "https://github.com/DataTables/Responsive",
|
||||
"_release": "1.0.3",
|
||||
"_release": "1.0.5",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.0.3",
|
||||
"commit": "21e780fff0ebf78ca67f714d8ec07ca4f20a104b"
|
||||
"tag": "1.0.5",
|
||||
"commit": "2c66f3b8b2dd04b83443c2695f8845285876e8e1"
|
||||
},
|
||||
"_source": "git://github.com/DataTables/Responsive.git",
|
||||
"_target": "~1.0.3",
|
||||
"_originalSource": "datatables-responsive",
|
||||
"_direct": true
|
||||
"_originalSource": "datatables-responsive"
|
||||
}
|
||||
20
bower_components/datatables-responsive/License.txt
vendored
Normal file
20
bower_components/datatables-responsive/License.txt
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2014-2015 SpryMedia Limited
|
||||
http://datatables.net
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "datatables-responsive",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.5",
|
||||
"main": [
|
||||
"js/dataTables.responsive.js",
|
||||
"css/dataTables.responsive.css"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
table.dataTable.dtr-inline.collapsed tbody td:first-child,
|
||||
table.dataTable.dtr-inline.collapsed tbody th:first-child {
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child,
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child {
|
||||
position: relative;
|
||||
padding-left: 30px;
|
||||
cursor: pointer;
|
||||
}
|
||||
table.dataTable.dtr-inline.collapsed tbody td:first-child:before,
|
||||
table.dataTable.dtr-inline.collapsed tbody th:first-child:before {
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child:before,
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child:before {
|
||||
top: 8px;
|
||||
left: 4px;
|
||||
height: 16px;
|
||||
@@ -22,25 +22,38 @@ table.dataTable.dtr-inline.collapsed tbody th:first-child:before {
|
||||
content: '+';
|
||||
background-color: #31b131;
|
||||
}
|
||||
table.dataTable.dtr-inline.collapsed tbody td:first-child.dataTables_empty:before,
|
||||
table.dataTable.dtr-inline.collapsed tbody th:first-child.dataTables_empty:before {
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child.dataTables_empty:before,
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child.dataTables_empty:before {
|
||||
display: none;
|
||||
}
|
||||
table.dataTable.dtr-inline.collapsed tbody tr.parent td:first-child:before,
|
||||
table.dataTable.dtr-inline.collapsed tbody tr.parent th:first-child:before {
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td:first-child:before,
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th:first-child:before {
|
||||
content: '-';
|
||||
background-color: #d33333;
|
||||
}
|
||||
table.dataTable.dtr-inline.collapsed tbody tr.child td:before {
|
||||
table.dataTable.dtr-inline.collapsed > tbody > tr.child td:before {
|
||||
display: none;
|
||||
}
|
||||
table.dataTable.dtr-column tbody td.control,
|
||||
table.dataTable.dtr-column tbody th.control {
|
||||
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child,
|
||||
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child {
|
||||
padding-left: 27px;
|
||||
}
|
||||
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child:before,
|
||||
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child:before {
|
||||
top: 5px;
|
||||
left: 4px;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
border-radius: 14px;
|
||||
line-height: 12px;
|
||||
}
|
||||
table.dataTable.dtr-column > tbody > tr > td.control,
|
||||
table.dataTable.dtr-column > tbody > tr > th.control {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
}
|
||||
table.dataTable.dtr-column tbody td.control:before,
|
||||
table.dataTable.dtr-column tbody th.control:before {
|
||||
table.dataTable.dtr-column > tbody > tr > td.control:before,
|
||||
table.dataTable.dtr-column > tbody > tr > th.control:before {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
height: 16px;
|
||||
@@ -59,35 +72,34 @@ table.dataTable.dtr-column tbody th.control:before {
|
||||
content: '+';
|
||||
background-color: #31b131;
|
||||
}
|
||||
table.dataTable.dtr-column tbody tr.parent td.control:before,
|
||||
table.dataTable.dtr-column tbody tr.parent th.control:before {
|
||||
table.dataTable.dtr-column > tbody > tr.parent td.control:before,
|
||||
table.dataTable.dtr-column > tbody > tr.parent th.control:before {
|
||||
content: '-';
|
||||
background-color: #d33333;
|
||||
}
|
||||
table.dataTable tr.child {
|
||||
table.dataTable > tbody > tr.child {
|
||||
padding: 0.5em 1em;
|
||||
}
|
||||
table.dataTable tr.child:hover {
|
||||
table.dataTable > tbody > tr.child:hover {
|
||||
background: transparent !important;
|
||||
}
|
||||
table.dataTable tr.child ul {
|
||||
table.dataTable > tbody > tr.child ul {
|
||||
display: inline-block;
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
table.dataTable tr.child ul li {
|
||||
table.dataTable > tbody > tr.child ul li {
|
||||
border-bottom: 1px solid #efefef;
|
||||
padding: 0.5em 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.dataTable tr.child ul li:first-child {
|
||||
table.dataTable > tbody > tr.child ul li:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
table.dataTable tr.child ul li:last-child {
|
||||
table.dataTable > tbody > tr.child ul li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
table.dataTable tr.child span.dtr-title {
|
||||
table.dataTable > tbody > tr.child span.dtr-title {
|
||||
display: inline-block;
|
||||
min-width: 75px;
|
||||
font-weight: bold;
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
//
|
||||
table.dataTable {
|
||||
// Styling for the `inline` type
|
||||
&.dtr-inline.collapsed tbody {
|
||||
td:first-child,
|
||||
th:first-child {
|
||||
&.dtr-inline.collapsed > tbody {
|
||||
> tr > td:first-child,
|
||||
> tr > th:first-child {
|
||||
position: relative;
|
||||
padding-left: 30px;
|
||||
cursor: pointer;
|
||||
@@ -51,23 +51,40 @@ table.dataTable {
|
||||
}
|
||||
}
|
||||
|
||||
tr.parent {
|
||||
td:first-child:before,
|
||||
th:first-child:before {
|
||||
> tr.parent {
|
||||
> td:first-child:before,
|
||||
> th:first-child:before {
|
||||
@include control-close;
|
||||
}
|
||||
}
|
||||
|
||||
tr.child td:before {
|
||||
> tr.child td:before {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
// DataTables' `compact` styling
|
||||
&.dtr-inline.collapsed.compact > tbody {
|
||||
> tr > td:first-child,
|
||||
> tr > th:first-child {
|
||||
padding-left: 27px;
|
||||
|
||||
&:before {
|
||||
top: 5px;
|
||||
left: 4px;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
border-radius: 14px;
|
||||
line-height: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Styling for the `column` type
|
||||
&.dtr-column tbody {
|
||||
td.control,
|
||||
th.control {
|
||||
&.dtr-column > tbody {
|
||||
> tr > td.control,
|
||||
> tr > th.control {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
|
||||
@@ -83,7 +100,7 @@ table.dataTable {
|
||||
}
|
||||
}
|
||||
|
||||
tr.parent {
|
||||
> tr.parent {
|
||||
td.control:before,
|
||||
th.control:before {
|
||||
@include control-close;
|
||||
@@ -93,7 +110,7 @@ table.dataTable {
|
||||
|
||||
|
||||
// Child row styling
|
||||
tr.child {
|
||||
> tbody > tr.child {
|
||||
padding: 0.5em 1em;
|
||||
|
||||
&:hover {
|
||||
@@ -109,7 +126,6 @@ table.dataTable {
|
||||
li {
|
||||
border-bottom: 1px solid #efefef;
|
||||
padding: 0.5em 0;
|
||||
white-space: nowrap;
|
||||
|
||||
&:first-child {
|
||||
padding-top: 0;
|
||||
|
||||
30
bower_components/datatables-responsive/docs/api/responsive.rebuild().xml
vendored
Normal file
30
bower_components/datatables-responsive/docs/api/responsive.rebuild().xml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dt-api group="responsive">
|
||||
<name>responsive.rebuild()</name>
|
||||
<summary>Recalculate the column breakpoints based on the class information of the column header cells</summary>
|
||||
<since>1.0.4</since>
|
||||
|
||||
<type type="function">
|
||||
<signature>responsive.rebuild()</signature>
|
||||
<description>Recalculate the column breakpoints based on the class information of the column header cells</description>
|
||||
<returns type="DataTables.Api">DataTables API instance</returns>
|
||||
</type>
|
||||
|
||||
<description>
|
||||
It can be useful to be able to control the column breakpoint information that Responsive responds to after a DataTable has been initialised. For example you may wish to provide user control over which columns are visible. This can be done using code that will add or remove the class `never` ([the other classes](http://datatables.net/extensions/responsive/classes) can also be used) and then calling this method.
|
||||
|
||||
You will also likely wish to immediately call `r-api responsive.recalc()` to have Responsive update the display for the change in classes. Having this as a separate call allows multiple changes to be drawn at the same time to help improve performance.
|
||||
</description>
|
||||
|
||||
<example title="Hide a column completely by adding a class name and rebuilding"><![CDATA[
|
||||
|
||||
var table = $('#example').DataTable();
|
||||
|
||||
$( table.column( 2 ).header() ).addClass( 'never' );
|
||||
|
||||
table.responsive.rebuild();
|
||||
table.responsive.recalc();
|
||||
|
||||
]]></example>
|
||||
|
||||
</dt-api>
|
||||
@@ -7,7 +7,7 @@
|
||||
<type type="function">
|
||||
<signature>responsive.recalc()</signature>
|
||||
<description>Recalculate the widths used by responsive after a change in the display</description>
|
||||
<returns type="DataTables.Api">DataTables API instance with the cached data for each selected cell in the result set</returns>
|
||||
<returns type="DataTables.Api">DataTables API instance</returns>
|
||||
</type>
|
||||
|
||||
<description>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
Note that if you define your own array of breakpoints, ordering of the breakpoints is not important. Responsive will automatically sort the array into its required internal order before using it.
|
||||
|
||||
Please note that as with all other configuration options for Responsive, this option is an extension to the [default set of DataTables options](/reference/init). This property should be set in the DataTables initialisation object.
|
||||
Please note that as with all other configuration options for Responsive, this option is an extension to the [default set of DataTables options](/reference/option). This property should be set in the DataTables initialisation object.
|
||||
</description>
|
||||
|
||||
<example title="Set custom breakpoints in the DataTables initialisation"><. This property should be set in the DataTables initialisation object.
|
||||
Please note that as with all other configuration options for Responsive, this option is an extension to the [default set of DataTables options](/reference/option). This property should be set in the DataTables initialisation object.
|
||||
</description>
|
||||
|
||||
<example title="Custom renderer which displays the data that has been hidden in an HTML table"><. This property should be set in the DataTables initialisation object.
|
||||
Please note that as with all other configuration options for Responsive, this option is an extension to the [default set of DataTables options](/reference/option). This property should be set in the DataTables initialisation object.
|
||||
</description>
|
||||
|
||||
<example title="Use the `column` control type and target the right most column"><. This property should be set in the DataTables initialisation object.
|
||||
Please note that as with all other configuration options for Responsive, this option is an extension to the [default set of DataTables options](/reference/option). This property should be set in the DataTables initialisation object.
|
||||
</description>
|
||||
|
||||
<example title="Use the `column` control type"><. This property should be set in the DataTables initialisation object.
|
||||
Please note that as with all other configuration options for Responsive, this option is an extension to the [default set of DataTables options](/reference/option). This property should be set in the DataTables initialisation object.
|
||||
</description>
|
||||
|
||||
<example title="Disable the details row display"><. This property should be set in the DataTables initialisation object.
|
||||
Please note that as with all other configuration options for Responsive, this option is an extension to the [default set of DataTables options](/reference/option). This property should be set in the DataTables initialisation object.
|
||||
</description>
|
||||
|
||||
<example title="Enable Responsive for a table"><![CDATA[
|
||||
|
||||
@@ -13,7 +13,7 @@ $(document).ready(function() {
|
||||
{ "data": "name" },
|
||||
{ "data": "position" },
|
||||
{ "data": "office" },
|
||||
{ "data": "extn" },
|
||||
{ "data": "age" },
|
||||
{ "data": "start_date" },
|
||||
{ "data": "salary" },
|
||||
{ "data": "extn" }
|
||||
|
||||
31
bower_components/datatables-responsive/examples/display-control/fixedHeader.xml
vendored
Normal file
31
bower_components/datatables-responsive/examples/display-control/fixedHeader.xml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dt-example table-type="html-wide" table-class="display nowrap" order="4">
|
||||
|
||||
<css lib="datatables responsive fixedheader">
|
||||
div.container { max-width: 1200px }
|
||||
</css>
|
||||
<js lib="jquery datatables responsive fixedheader">
|
||||
<![CDATA[
|
||||
|
||||
$(document).ready(function() {
|
||||
var table = $('#example').DataTable( {
|
||||
responsive: true,
|
||||
paging: false
|
||||
} );
|
||||
|
||||
new $.fn.dataTable.FixedHeader( table );
|
||||
} );
|
||||
|
||||
]]>
|
||||
</js>
|
||||
|
||||
<title lib="Responsive">With FixedHeader</title>
|
||||
|
||||
<info>< extension. FixedHeader will lock a table's header to the top of the table, ensuring that the user always knows what each column relates to.
|
||||
|
||||
]]></info>
|
||||
|
||||
</dt-example>
|
||||
|
||||
@@ -13,7 +13,7 @@ $(document).ready(function() {
|
||||
{ "data": "name", className: "all" },
|
||||
{ "data": "position", className: "min-phone-l" },
|
||||
{ "data": "office", className: "min-tablet" },
|
||||
{ "data": "extn", className: "min-tablet" },
|
||||
{ "data": "age", className: "min-tablet" },
|
||||
{ "data": "start_date", className: "never" },
|
||||
{ "data": "salary", className: "desktop" },
|
||||
{ "data": "extn", className: "none" }
|
||||
|
||||
29
bower_components/datatables-responsive/examples/styling/compact.xml
vendored
Normal file
29
bower_components/datatables-responsive/examples/styling/compact.xml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dt-example table-type="html-wide" table-class="display compact nowrap" order="4">
|
||||
|
||||
<css lib="datatables responsive">
|
||||
div.container { max-width: 1200px }
|
||||
</css>
|
||||
<js lib="jquery datatables responsive">
|
||||
<![CDATA[
|
||||
|
||||
$(document).ready(function() {
|
||||
var table = $('#example').DataTable();
|
||||
|
||||
new $.fn.dataTable.Responsive( table );
|
||||
} );
|
||||
|
||||
]]>
|
||||
</js>
|
||||
|
||||
<title lib="Responsive">Compact styling</title>
|
||||
|
||||
<info>< has a number number of features available that can be enabled by including a class name on the DataTable. One of those options is `compact` which displays the DataTable with less whitespace padding that might other be used to increase the information density of the table. Responsive's own style has support for this `compact` styling as showing in this example.
|
||||
|
||||
|
||||
]]></info>
|
||||
|
||||
</dt-example>
|
||||
|
||||
33
bower_components/datatables-responsive/examples/styling/scrolling.xml
vendored
Normal file
33
bower_components/datatables-responsive/examples/styling/scrolling.xml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dt-example table-type="html-wide" table-class="display nowrap" order="3">
|
||||
|
||||
<css lib="datatables responsive">
|
||||
div.container { max-width: 1200px }
|
||||
</css>
|
||||
<js lib="jquery datatables responsive">
|
||||
<![CDATA[
|
||||
|
||||
$(document).ready(function() {
|
||||
var table = $('#example').DataTable( {
|
||||
scrollY: 300,
|
||||
paging: false
|
||||
} );
|
||||
|
||||
new $.fn.dataTable.Responsive( table );
|
||||
} );
|
||||
|
||||
]]>
|
||||
</js>
|
||||
|
||||
<title lib="Responsive">Vertical scrolling</title>
|
||||
|
||||
<info><![CDATA[
|
||||
|
||||
This example shows Responsive in use with the `dt-init scrollY` option to present a scrolling table (instead of using paging as the other Responsive examples do). Responsive will automatically work with the table in such a configuration.
|
||||
|
||||
Responsive can be used with `dt-init scrollX`, however it is relatively pointless as Responsive will remove columns to ensure that there is no horizontal scrolling!
|
||||
|
||||
]]></info>
|
||||
|
||||
</dt-example>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/*! Responsive 1.0.3
|
||||
* 2014 SpryMedia Ltd - datatables.net/license
|
||||
/*! Responsive 1.0.5
|
||||
* 2014-2015 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @summary Responsive
|
||||
* @description Responsive tables plug-in for DataTables
|
||||
* @version 1.0.3
|
||||
* @version 1.0.5
|
||||
* @file dataTables.responsive.js
|
||||
* @author SpryMedia Ltd (www.sprymedia.co.uk)
|
||||
* @contact www.sprymedia.co.uk/contact
|
||||
* @copyright Copyright 2014 SpryMedia Ltd.
|
||||
* @copyright Copyright 2014-2015 SpryMedia Ltd.
|
||||
*
|
||||
* This source file is free software, available under the following license:
|
||||
* MIT license - http://datatables.net/license/mit
|
||||
@@ -133,16 +133,13 @@ Responsive.prototype = {
|
||||
} );
|
||||
|
||||
// Determine which columns are already hidden, and should therefore
|
||||
// remain hidden. TODO - should this be done? See thread 22677
|
||||
// remain hidden. todo - should this be done? See thread 22677
|
||||
//
|
||||
// this.s.alwaysHidden = dt.columns(':hidden').indexes();
|
||||
|
||||
this._classLogic();
|
||||
this._resizeAuto();
|
||||
|
||||
// First pass - draw the table for the current viewport size
|
||||
this._resize();
|
||||
|
||||
// Details handler
|
||||
var details = this.c.details;
|
||||
if ( details.type ) {
|
||||
@@ -156,7 +153,7 @@ Responsive.prototype = {
|
||||
// Redraw the details box on each draw. This is used until
|
||||
// DataTables implements a native `updated` event for rows
|
||||
dt.on( 'draw.dtr', function () {
|
||||
dt.rows().iterator( 'row', function ( settings, idx ) {
|
||||
dt.rows( {page: 'current'} ).iterator( 'row', function ( settings, idx ) {
|
||||
var row = dt.row( idx );
|
||||
|
||||
if ( row.child.isShown() ) {
|
||||
@@ -168,6 +165,9 @@ Responsive.prototype = {
|
||||
|
||||
$(dt.table().node()).addClass( 'dtr-'+details.type );
|
||||
}
|
||||
|
||||
// First pass - draw the table for the current viewport size
|
||||
this._resize();
|
||||
},
|
||||
|
||||
|
||||
@@ -213,8 +213,14 @@ Responsive.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
// Second pass, use up any remaining width for other columns
|
||||
var widthAvailable = dt.table().container().offsetWidth;
|
||||
// Second pass, use up any remaining width for other columns. For
|
||||
// scrolling tables we need to subtract the width of the scrollbar. It
|
||||
// may not be requires which makes this sub-optimal, but it would
|
||||
// require another full redraw to make complete use of those extra few
|
||||
// pixels
|
||||
var scrolling = dt.settings()[0].oScroll;
|
||||
var bar = scrolling.sY || scrolling.sX ? scrolling.iBarWidth : 0;
|
||||
var widthAvailable = dt.table().container().offsetWidth - bar;
|
||||
var usedWidth = widthAvailable - requiredWidth;
|
||||
|
||||
// Control column needs to always be included. This makes it sub-
|
||||
@@ -230,11 +236,19 @@ Responsive.prototype = {
|
||||
|
||||
// Allow columns to be shown (counting from the left) until we run out
|
||||
// of room
|
||||
var empty = false;
|
||||
for ( i=0, ien=display.length ; i<ien ; i++ ) {
|
||||
if ( display[i] === '-' && ! columns[i].control ) {
|
||||
display[i] = usedWidth - columns[i].minWidth < 0 ?
|
||||
false :
|
||||
true;
|
||||
// Once we've found a column that won't fit we don't let any
|
||||
// others display either, or columns might disappear in the
|
||||
// middle of the table
|
||||
if ( empty || usedWidth - columns[i].minWidth < 0 ) {
|
||||
empty = true;
|
||||
display[i] = false;
|
||||
}
|
||||
else {
|
||||
display[i] = true;
|
||||
}
|
||||
|
||||
usedWidth -= columns[i].minWidth;
|
||||
}
|
||||
@@ -493,11 +507,8 @@ Responsive.prototype = {
|
||||
}
|
||||
|
||||
if ( haveHidden ) {
|
||||
// Got hidden columns
|
||||
$( dt.table().node() ).addClass('collapsed');
|
||||
|
||||
// Show all existing child rows
|
||||
dt.rows().eq(0).each( function (idx) {
|
||||
dt.rows( { page: 'current' } ).eq(0).each( function (idx) {
|
||||
var row = dt.row( idx );
|
||||
|
||||
if ( row.child() ) {
|
||||
@@ -514,11 +525,8 @@ Responsive.prototype = {
|
||||
} );
|
||||
}
|
||||
else {
|
||||
// No hidden columns
|
||||
$( dt.table().node() ).removeClass('collapsed');
|
||||
|
||||
// Hide all existing child rows
|
||||
dt.rows().eq(0).each( function (idx) {
|
||||
dt.rows( { page: 'current' } ).eq(0).each( function (idx) {
|
||||
dt.row( idx ).child.hide();
|
||||
} );
|
||||
}
|
||||
@@ -555,9 +563,11 @@ Responsive.prototype = {
|
||||
var width = $(window).width();
|
||||
var breakpoints = this.c.breakpoints;
|
||||
var breakpoint = breakpoints[0].name;
|
||||
var columns = this.s.columns;
|
||||
var i, ien;
|
||||
|
||||
// Determine what breakpoint we are currently at
|
||||
for ( var i=breakpoints.length-1 ; i>=0 ; i-- ) {
|
||||
for ( i=breakpoints.length-1 ; i>=0 ; i-- ) {
|
||||
if ( width <= breakpoints[i].width ) {
|
||||
breakpoint = breakpoints[i].name;
|
||||
break;
|
||||
@@ -565,10 +575,23 @@ Responsive.prototype = {
|
||||
}
|
||||
|
||||
// Show the columns for that break point
|
||||
var columns = this._columnsVisiblity( breakpoint );
|
||||
var columnsVis = this._columnsVisiblity( breakpoint );
|
||||
|
||||
// Set the class before the column visibility is changed so event
|
||||
// listeners know what the state is. Need to determine if there are
|
||||
// any columns that are not visible but can be shown
|
||||
var collapsedClass = false;
|
||||
for ( i=0, ien=columns.length ; i<ien ; i++ ) {
|
||||
if ( columnsVis[i] === false && ! columns[i].never ) {
|
||||
collapsedClass = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$( dt.table().node() ).toggleClass('collapsed', collapsedClass );
|
||||
|
||||
dt.columns().eq(0).each( function ( colIdx, i ) {
|
||||
dt.column( colIdx ).visible( columns[i] );
|
||||
dt.column( colIdx ).visible( columnsVis[i] );
|
||||
} );
|
||||
},
|
||||
|
||||
@@ -604,6 +627,8 @@ Responsive.prototype = {
|
||||
var clonedHeader = $( dt.table().header().cloneNode( false ) ).appendTo( clonedTable );
|
||||
var clonedBody = $( dt.table().body().cloneNode( false ) ).appendTo( clonedTable );
|
||||
|
||||
$( dt.table().footer() ).clone( false ).appendTo( clonedTable );
|
||||
|
||||
// This is a bit slow, but we need to get a clone of each row that
|
||||
// includes all columns. As such, try to do this as little as possible.
|
||||
dt.rows( { page: 'current' } ).indexes().flatten().each( function ( idx ) {
|
||||
@@ -616,8 +641,12 @@ Responsive.prototype = {
|
||||
$(clone).appendTo( clonedBody );
|
||||
} );
|
||||
|
||||
var cells = dt.columns().header().to$().clone( false ).wrapAll('tr').appendTo( clonedHeader );
|
||||
var inserted = $('<div/>')
|
||||
var cells = dt.columns().header().to$().clone( false );
|
||||
$('<tr/>')
|
||||
.append( cells )
|
||||
.appendTo( clonedHeader );
|
||||
|
||||
var inserted = $('<div/>')
|
||||
.css( {
|
||||
width: 1,
|
||||
height: 1,
|
||||
@@ -716,10 +745,14 @@ Responsive.defaults = {
|
||||
var cellData = dtPrivate.oApi._fnGetCellData(
|
||||
dtPrivate, idx.row, idx.column, 'display'
|
||||
);
|
||||
var title = header.text();
|
||||
if ( title ) {
|
||||
title = title + ':';
|
||||
}
|
||||
|
||||
return '<li data-dtr-index="'+idx.column+'">'+
|
||||
'<span class="dtr-title">'+
|
||||
header.text()+':'+
|
||||
title+
|
||||
'</span> '+
|
||||
'<span class="dtr-data">'+
|
||||
cellData+
|
||||
@@ -749,15 +782,6 @@ Api.register( 'responsive()', function () {
|
||||
return this;
|
||||
} );
|
||||
|
||||
Api.register( 'responsive.recalc()', function () {
|
||||
this.iterator( 'table', function ( ctx ) {
|
||||
if ( ctx._responsive ) {
|
||||
ctx._responsive._resizeAuto();
|
||||
ctx._responsive._resize();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
Api.register( 'responsive.index()', function ( li ) {
|
||||
li = $(li);
|
||||
|
||||
@@ -767,6 +791,23 @@ Api.register( 'responsive.index()', function ( li ) {
|
||||
};
|
||||
} );
|
||||
|
||||
Api.register( 'responsive.rebuild()', function () {
|
||||
return this.iterator( 'table', function ( ctx ) {
|
||||
if ( ctx._responsive ) {
|
||||
ctx._responsive._classLogic();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
Api.register( 'responsive.recalc()', function () {
|
||||
return this.iterator( 'table', function ( ctx ) {
|
||||
if ( ctx._responsive ) {
|
||||
ctx._responsive._resizeAuto();
|
||||
ctx._responsive._resize();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
|
||||
/**
|
||||
* Version information
|
||||
@@ -774,7 +815,7 @@ Api.register( 'responsive.index()', function ( li ) {
|
||||
* @name Responsive.version
|
||||
* @static
|
||||
*/
|
||||
Responsive.version = '1.0.3';
|
||||
Responsive.version = '1.0.5';
|
||||
|
||||
|
||||
$.fn.dataTable.Responsive = Responsive;
|
||||
@@ -783,11 +824,17 @@ $.fn.DataTable.Responsive = Responsive;
|
||||
// Attach a listener to the document which listens for DataTables initialisation
|
||||
// events so we can automatically initialise
|
||||
$(document).on( 'init.dt.dtr', function (e, settings, json) {
|
||||
if ( e.namespace !== 'dt' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $(settings.nTable).hasClass( 'responsive' ) ||
|
||||
$(settings.nTable).hasClass( 'dt-responsive' ) ||
|
||||
settings.oInit.responsive ||
|
||||
DataTable.defaults.responsive
|
||||
) {
|
||||
console.log( e.namespace );
|
||||
|
||||
var init = settings.oInit.responsive;
|
||||
|
||||
if ( init !== false ) {
|
||||
@@ -815,4 +862,3 @@ else if ( jQuery && !jQuery.fn.dataTable.Responsive ) {
|
||||
|
||||
|
||||
})(window, document);
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ js_compress $OUT_DIR/js/dataTables.responsive.js
|
||||
rsync -r examples $OUT_DIR
|
||||
examples_process $OUT_DIR/examples
|
||||
|
||||
# Readme
|
||||
# Readme and license
|
||||
cp Readme.md $OUT_DIR
|
||||
cp License.txt $OUT_DIR
|
||||
|
||||
|
||||
Reference in New Issue
Block a user