jquery-datatables-rails 1.9.1.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/Readme.md +27 -1
- data/lib/jquery/datatables/rails/version.rb +1 -1
- data/vendor/assets/javascripts/dataTables/extras/FixedColumns.js +1226 -0
- data/vendor/assets/javascripts/dataTables/extras/FixedHeader.js +937 -0
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.api.fnGetColumnData.js +54 -0
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.api.fnReloadAjax.js +44 -0
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.sorting.numbersHtml.js +15 -0
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.typeDetection.numbersHtml.js +40 -0
- metadata +17 -5
@@ -0,0 +1,54 @@
|
|
1
|
+
(function($) {
|
2
|
+
/*
|
3
|
+
* Function: fnGetColumnData
|
4
|
+
* Purpose: Return an array of table values from a particular column.
|
5
|
+
* Returns: array string: 1d data array
|
6
|
+
* Inputs: object:oSettings - dataTable settings object. This is always the last argument past to the function
|
7
|
+
* int:iColumn - the id of the column to extract the data from
|
8
|
+
* bool:bUnique - optional - if set to false duplicated values are not filtered out
|
9
|
+
* bool:bFiltered - optional - if set to false all the table data is used (not only the filtered)
|
10
|
+
* bool:bIgnoreEmpty - optional - if set to false empty values are not filtered from the result array
|
11
|
+
* Author: Benedikt Forchhammer <b.forchhammer /AT\ mind2.de>
|
12
|
+
*/
|
13
|
+
$.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
|
14
|
+
// check that we have a column id
|
15
|
+
if ( typeof iColumn == "undefined" ) return new Array();
|
16
|
+
|
17
|
+
// by default we only wany unique data
|
18
|
+
if ( typeof bUnique == "undefined" ) bUnique = true;
|
19
|
+
|
20
|
+
// by default we do want to only look at filtered data
|
21
|
+
if ( typeof bFiltered == "undefined" ) bFiltered = true;
|
22
|
+
|
23
|
+
// by default we do not wany to include empty values
|
24
|
+
if ( typeof bIgnoreEmpty == "undefined" ) bIgnoreEmpty = true;
|
25
|
+
|
26
|
+
// list of rows which we're going to loop through
|
27
|
+
var aiRows;
|
28
|
+
|
29
|
+
// use only filtered rows
|
30
|
+
if (bFiltered == true) aiRows = oSettings.aiDisplay;
|
31
|
+
// use all rows
|
32
|
+
else aiRows = oSettings.aiDisplayMaster; // all row numbers
|
33
|
+
|
34
|
+
// set up data array
|
35
|
+
var asResultData = new Array();
|
36
|
+
|
37
|
+
for (var i=0,c=aiRows.length; i<c; i++) {
|
38
|
+
iRow = aiRows[i];
|
39
|
+
var sValue = this.fnGetData(iRow, iColumn);
|
40
|
+
|
41
|
+
// ignore empty values?
|
42
|
+
if (bIgnoreEmpty == true && sValue.length == 0) continue;
|
43
|
+
|
44
|
+
// ignore unique values?
|
45
|
+
else if (bUnique == true && jQuery.inArray(sValue, asResultData) > -1) continue;
|
46
|
+
|
47
|
+
// else push the value onto the result data array
|
48
|
+
else asResultData.push(sValue);
|
49
|
+
}
|
50
|
+
|
51
|
+
return asResultData;
|
52
|
+
}
|
53
|
+
|
54
|
+
}(jQuery));
|
@@ -0,0 +1,44 @@
|
|
1
|
+
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw )
|
2
|
+
{
|
3
|
+
if ( typeof sNewSource != 'undefined' && sNewSource != null )
|
4
|
+
{
|
5
|
+
oSettings.sAjaxSource = sNewSource;
|
6
|
+
}
|
7
|
+
this.oApi._fnProcessingDisplay( oSettings, true );
|
8
|
+
var that = this;
|
9
|
+
var iStart = oSettings._iDisplayStart;
|
10
|
+
var aData = [];
|
11
|
+
|
12
|
+
this.oApi._fnServerParams( oSettings, aData );
|
13
|
+
|
14
|
+
oSettings.fnServerData( oSettings.sAjaxSource, aData, function(json) {
|
15
|
+
/* Clear the old information from the table */
|
16
|
+
that.oApi._fnClearTable( oSettings );
|
17
|
+
|
18
|
+
/* Got the data - add it to the table */
|
19
|
+
var aData = (oSettings.sAjaxDataProp !== "") ?
|
20
|
+
that.oApi._fnGetObjectDataFn( oSettings.sAjaxDataProp )( json ) : json;
|
21
|
+
|
22
|
+
for ( var i=0 ; i<aData.length ; i++ )
|
23
|
+
{
|
24
|
+
that.oApi._fnAddData( oSettings, aData[i] );
|
25
|
+
}
|
26
|
+
|
27
|
+
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
|
28
|
+
that.fnDraw();
|
29
|
+
|
30
|
+
if ( typeof bStandingRedraw != 'undefined' && bStandingRedraw === true )
|
31
|
+
{
|
32
|
+
oSettings._iDisplayStart = iStart;
|
33
|
+
that.fnDraw( false );
|
34
|
+
}
|
35
|
+
|
36
|
+
that.oApi._fnProcessingDisplay( oSettings, false );
|
37
|
+
|
38
|
+
/* Callback user function - for event handlers etc */
|
39
|
+
if ( typeof fnCallback == 'function' && fnCallback != null )
|
40
|
+
{
|
41
|
+
fnCallback( oSettings );
|
42
|
+
}
|
43
|
+
}, oSettings );
|
44
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
jQuery.fn.dataTableExt.oSort['num-html-asc'] = function(a,b) {
|
2
|
+
var x = a.replace( /<.*?>/g, "" );
|
3
|
+
var y = b.replace( /<.*?>/g, "" );
|
4
|
+
x = parseFloat( x );
|
5
|
+
y = parseFloat( y );
|
6
|
+
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
7
|
+
};
|
8
|
+
|
9
|
+
jQuery.fn.dataTableExt.oSort['num-html-desc'] = function(a,b) {
|
10
|
+
var x = a.replace( /<.*?>/g, "" );
|
11
|
+
var y = b.replace( /<.*?>/g, "" );
|
12
|
+
x = parseFloat( x );
|
13
|
+
y = parseFloat( y );
|
14
|
+
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
|
15
|
+
};
|
@@ -0,0 +1,40 @@
|
|
1
|
+
jQuery.fn.dataTableExt.aTypes.unshift( function ( sData )
|
2
|
+
{
|
3
|
+
sData = typeof sData.replace == 'function' ?
|
4
|
+
sData.replace( /<.*?>/g, "" ) : sData;
|
5
|
+
sData = $.trim(sData);
|
6
|
+
|
7
|
+
var sValidFirstChars = "0123456789-";
|
8
|
+
var sValidChars = "0123456789.";
|
9
|
+
var Char;
|
10
|
+
var bDecimal = false;
|
11
|
+
|
12
|
+
/* Check for a valid first char (no period and allow negatives) */
|
13
|
+
Char = sData.charAt(0);
|
14
|
+
if (sValidFirstChars.indexOf(Char) == -1)
|
15
|
+
{
|
16
|
+
return null;
|
17
|
+
}
|
18
|
+
|
19
|
+
/* Check all the other characters are valid */
|
20
|
+
for ( var i=1 ; i<sData.length ; i++ )
|
21
|
+
{
|
22
|
+
Char = sData.charAt(i);
|
23
|
+
if (sValidChars.indexOf(Char) == -1)
|
24
|
+
{
|
25
|
+
return null;
|
26
|
+
}
|
27
|
+
|
28
|
+
/* Only allowed one decimal place... */
|
29
|
+
if ( Char == "." )
|
30
|
+
{
|
31
|
+
if ( bDecimal )
|
32
|
+
{
|
33
|
+
return null;
|
34
|
+
}
|
35
|
+
bDecimal = true;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
return 'num-html';
|
40
|
+
} );
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-datatables-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jquery-rails
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,12 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
description: ''
|
26
31
|
email:
|
27
32
|
- robin@wenglewski.de
|
@@ -31,6 +36,7 @@ extra_rdoc_files: []
|
|
31
36
|
files:
|
32
37
|
- .gitignore
|
33
38
|
- Gemfile
|
39
|
+
- LICENSE
|
34
40
|
- Rakefile
|
35
41
|
- Readme.md
|
36
42
|
- jquery-datatables-rails.gemspec
|
@@ -49,8 +55,14 @@ files:
|
|
49
55
|
- vendor/assets/images/dataTables/sort_both.png
|
50
56
|
- vendor/assets/images/dataTables/sort_desc.png
|
51
57
|
- vendor/assets/images/dataTables/sort_desc_disabled.png
|
58
|
+
- vendor/assets/javascripts/dataTables/extras/FixedColumns.js
|
59
|
+
- vendor/assets/javascripts/dataTables/extras/FixedHeader.js
|
60
|
+
- vendor/assets/javascripts/dataTables/jquery.dataTables.api.fnGetColumnData.js
|
61
|
+
- vendor/assets/javascripts/dataTables/jquery.dataTables.api.fnReloadAjax.js
|
52
62
|
- vendor/assets/javascripts/dataTables/jquery.dataTables.bootstrap.js
|
53
63
|
- vendor/assets/javascripts/dataTables/jquery.dataTables.js
|
64
|
+
- vendor/assets/javascripts/dataTables/jquery.dataTables.sorting.numbersHtml.js
|
65
|
+
- vendor/assets/javascripts/dataTables/jquery.dataTables.typeDetection.numbersHtml.js
|
54
66
|
- vendor/assets/stylesheets/dataTables/jquery.dataTables.bootstrap.css.scss
|
55
67
|
- vendor/assets/stylesheets/dataTables/jquery.dataTables.css.scss
|
56
68
|
- vendor/assets/stylesheets/dataTables/src/demo_page.css
|
@@ -77,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
89
|
version: '0'
|
78
90
|
requirements: []
|
79
91
|
rubyforge_project:
|
80
|
-
rubygems_version: 1.8.
|
92
|
+
rubygems_version: 1.8.24
|
81
93
|
signing_key:
|
82
94
|
specification_version: 3
|
83
95
|
summary: jquery datatables for rails
|