effective_datatables 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32d85c8ad7664954cac2285e04ffc503a5c6385e
4
- data.tar.gz: 5fd451f1b6a10e08de8fc6820721d21b4279f19c
3
+ metadata.gz: 974ccbf528f6947d0eca568ad9af53bb29ee0eca
4
+ data.tar.gz: 8f3836e0bf9b4b9fc36ee79acd361e47c7c5faae
5
5
  SHA512:
6
- metadata.gz: ad105c7e0855fe642b4f74e0cd89860762e629713f119d614398acff973d509f4b19904770c8ed95fc7227641d7d74f99d5ff14380d20611d9e1902159119bd3
7
- data.tar.gz: a735ea5474c5e3b04b0f63df4976259fd8907e589e08bfa6084f26726ac1f58ca1b40840f69b3508dfc5457d3544b8b1326cc2dd996ed5c69fdfea5074c04c7e
6
+ metadata.gz: 82c049842341821b4df913db9c7be555b36aee6070c4629df352ae33bdc7b61913bdc5a60a10344697ca2cd2a7b170077830b0e8c0c56ba505abc31c19ccc925
7
+ data.tar.gz: fa9f8b1485760f5e0ad04be8b9f4d0e08470abc476582452030ebcd6796d6bb7d5c9476ef790359c6ee62a70949b26bea6f76af3edd832cdedd08c06e0d90f76
@@ -7,5 +7,5 @@
7
7
  //= require_tree ./effective_datatables
8
8
 
9
9
  $.extend( $.fn.dataTable.defaults, {
10
- 'dom': "<'row'<'span4'l><'span4'T><'span4'f>r>t<'row'<'span6'i><'span6'p>>"
10
+ 'dom': "<'row'<'span6'l><'span6'TC>r>t<'row'<'span6'i><'span6'p>>"
11
11
  });
@@ -7,6 +7,6 @@
7
7
  //= require_tree ./effective_datatables
8
8
 
9
9
  $.extend( $.fn.dataTable.defaults, {
10
- 'dom': "<'row'<'col-xs-4'l><'col-xs-4'T><'col-xs-4'fC>r>t<'row'<'col-xs-6'i><'col-xs-6'p>>"
10
+ 'dom': "<'row'<'col-xs-6'l><'col-xs-6'TC>r>t<'row'<'col-xs-6'i><'col-xs-6'p>>"
11
11
  });
12
12
 
@@ -21,16 +21,27 @@ initializeDataTables = ->
21
21
  iDisplayLength: 25
22
22
  fnServerParams: (aoData, a, b) ->
23
23
  table = this.DataTable()
24
- table.columns().flatten().each (index) ->
24
+ table.columns().flatten().each (index) -> # Pass which columns are visible back to server
25
25
  aoData.push({'name': "sVisible_#{index}", 'value': table.column(index).visible()})
26
+
27
+ # If this is the very first request to the server we have to manually set any selected filter options here
28
+ # So that we can skip an fnFilter call in the dataTables.columnFilter that results in a double AJAX call
29
+ ((sEcho = data; break) if data.name == 'sEcho') for data in aoData
30
+ if sEcho && sEcho.value == 1
31
+ $.each (datatable.data('filter') || []), (index, filter) ->
32
+ if(filter.selected)
33
+ sSearch = undefined
34
+ ((sSearch = data; break) if data.name == "sSearch_#{index}") for data in aoData
35
+ sSearch.value = filter.selected if sSearch
36
+
26
37
  aoColumnDefs: aoColumnDefs
27
38
  aoColumns: datatable.data('widths')
28
39
  oTableTools:
29
40
  sSwfPath: '/assets/effective_datatables/copy_csv_xls_pdf.swf',
30
- aButtons: ['copy', 'csv', 'pdf', 'print']
41
+ aButtons: ['csv', {'sExtends': 'xls', 'sButtonText': 'Excel'}, 'print']
31
42
  colVis:
32
43
  showAll: 'Show all'
33
- restore: 'Restore default visible'
44
+ restore: 'Show default'
34
45
  activate: 'mouseover'
35
46
  fnStateChange: (iCol, bVisible) ->
36
47
  table = $(this.dom.button).closest('.dataTables_wrapper').children('table').first().DataTable()
@@ -44,7 +55,9 @@ initializeDataTables = ->
44
55
  init_options['dom'] = "<'row'r>t" # Just show the table
45
56
 
46
57
  # Actually initialize it
58
+ console.log('blah')
47
59
  datatable = datatable.dataTable(init_options)
60
+ console.log('initted')
48
61
 
49
62
  if filter
50
63
  datatable.columnFilter
@@ -52,10 +65,5 @@ initializeDataTables = ->
52
65
  aoColumns : datatable.data('filter')
53
66
  bUseColVis: true
54
67
 
55
- $('.dataTables_filter').each ->
56
- $(this).html("<button class='btn-reset-filters ColVis_Button' data-effective-datatables-reset-filters='true'><span>Reset Filters</span></button>")
57
-
58
68
  $ -> initializeDataTables()
59
69
  $(document).on 'page:change', -> initializeDataTables()
60
-
61
- $(document).on 'click', '[data-effective-datatables-reset-filters]', (event) -> window.location.reload()
@@ -404,8 +404,11 @@
404
404
  oTable.fnFilter(unescape($(this).val()), iColumn); //Issue 25
405
405
  fnOnFiltered();
406
406
  });
407
- if (currentFilter != null && currentFilter != "")//Issue 81
408
- oTable.fnFilter(unescape(currentFilter), iColumn);
407
+ // Commented out by Matt.
408
+ // Removing this and hackign the fnServerParams for the first request
409
+ // Prevents a double AJAX call
410
+ // if (currentFilter != null && currentFilter != "")//Issue 81
411
+ // oTable.fnFilter(unescape(currentFilter), iColumn);
409
412
  }
410
413
  }
411
414
 
@@ -110,9 +110,8 @@
110
110
  }
111
111
 
112
112
  .DTTT_container {
113
- float: none;
114
- width: 190px;
115
- margin: auto;
113
+ float: right;
114
+ margin-right: -3px;
116
115
  }
117
116
  }
118
117
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '1.2.2'.freeze
2
+ VERSION = '1.2.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2015-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails