effective_datatables 4.23.0 → 4.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/effective_datatables/initialize.js.coffee +11 -1
- data/app/assets/javascripts/effective_datatables/reset.js.coffee +0 -6
- data/app/assets/javascripts/effective_datatables.js +0 -1
- data/lib/effective_datatables/version.rb +1 -1
- metadata +2 -3
- data/app/assets/javascripts/vendor/jquery.delayedChange.js +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75aeba8a18f22cd6b4e5b0761e166ae919a10a59c77c918881cb117e13f76932
|
4
|
+
data.tar.gz: d84af5dea6afa6093d35a3421f2708321b63bf4f7e3706a28eb5cdd004bb9de7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b28b5aa883d030911aa842e8478aa641d1effc8c3aa1eaa51fb2a865d14a96183a6dd8079602718685e0f442c53a1e9af42fd0eaeaffc79c72308eb967b88d0
|
7
|
+
data.tar.gz: 6cd70258a3e9ad0efd861b4a47a2eb8140f478cf90f6ce1eff0c642b18e8d02d131c0a5574728caf3a99f2803ab8b4d8671297142d8f87c2db5e587b901bc17f
|
@@ -158,7 +158,8 @@ initializeDataTables = (target) ->
|
|
158
158
|
if $input.is('select')
|
159
159
|
$input.on 'change', (event) -> dataTableSearch($(event.currentTarget))
|
160
160
|
else if $input.is('input')
|
161
|
-
$input.
|
161
|
+
$input.keyup(delayChange((-> dataTableSearch($input)), 500))
|
162
|
+
$input.on 'paste', (event) -> delayChange((-> dataTableSearch($(event.currentTarget))), 100)
|
162
163
|
|
163
164
|
# Do the actual search
|
164
165
|
dataTableSearch = ($input) -> # This is the function called by a select or input to run the search
|
@@ -201,6 +202,15 @@ destroyDataTables = ->
|
|
201
202
|
$('.effective-datatables-inline-expanded').removeClass('effective-datatables-inline-expanded')
|
202
203
|
$('table.effective-datatable').each -> try $(this).removeClass('initialized').DataTable().destroy()
|
203
204
|
|
205
|
+
# https://stackoverflow.com/questions/1909441/how-to-delay-the-keyup-handler-until-the-user-stops-typing
|
206
|
+
delayChange = (callback, ms) ->
|
207
|
+
timer = 0
|
208
|
+
->
|
209
|
+
context = this
|
210
|
+
args = arguments
|
211
|
+
clearTimeout(timer)
|
212
|
+
timer = setTimeout((-> callback.apply(context, args)), ms)
|
213
|
+
|
204
214
|
$ -> initializeDataTables()
|
205
215
|
$(document).on 'effective-datatables:initialize', (event) -> initializeDataTables(event.currentTarget)
|
206
216
|
|
@@ -11,12 +11,6 @@ $(document).on 'click', '.dataTables_wrapper a.buttons-reset-search', (event) ->
|
|
11
11
|
$inputs = $thead.find('input')
|
12
12
|
$inputs.val('').removeAttr('checked').removeAttr('selected')
|
13
13
|
|
14
|
-
# Reset delayedChange
|
15
|
-
$.each $inputs, (input) =>
|
16
|
-
$input = $(input)
|
17
|
-
if ($input.delayedChange.oldVal)
|
18
|
-
$input.delayedChange.oldVal = undefined
|
19
|
-
|
20
14
|
# Reset the datatable
|
21
15
|
datatable = $table.DataTable()
|
22
16
|
|
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: 4.
|
4
|
+
version: 4.24.0
|
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: 2024-
|
11
|
+
date: 2024-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -122,7 +122,6 @@ files:
|
|
122
122
|
- app/assets/javascripts/effective_datatables/reorder.js.coffee
|
123
123
|
- app/assets/javascripts/effective_datatables/reset.js.coffee
|
124
124
|
- app/assets/javascripts/effective_datatables/responsive.js.coffee
|
125
|
-
- app/assets/javascripts/vendor/jquery.delayedChange.js
|
126
125
|
- app/assets/javascripts/vendor/jquery.fileDownload.js
|
127
126
|
- app/assets/stylesheets/dataTables/buttons/buttons.bootstrap4.scss
|
128
127
|
- app/assets/stylesheets/dataTables/dataTables.bootstrap4.scss
|
@@ -1,37 +0,0 @@
|
|
1
|
-
// http://stackoverflow.com/questions/7373023/throttle-event-calls-in-jquery
|
2
|
-
|
3
|
-
(function($) {
|
4
|
-
$.fn.delayedChange = function(options) {
|
5
|
-
var timer; var o;
|
6
|
-
|
7
|
-
if (jQuery.isFunction(options)) {
|
8
|
-
o = { onChange: options };
|
9
|
-
} else {
|
10
|
-
o = options;
|
11
|
-
}
|
12
|
-
|
13
|
-
o = $.extend({}, $.fn.delayedChange.defaultOptions, o);
|
14
|
-
|
15
|
-
return this.each(function() {
|
16
|
-
var element = $(this);
|
17
|
-
element.on('keyup paste', function() {
|
18
|
-
clearTimeout(timer);
|
19
|
-
timer = setTimeout(function() {
|
20
|
-
var newVal = element.val();
|
21
|
-
if (element.delayedChange.oldVal != newVal) {
|
22
|
-
element.delayedChange.oldVal = newVal;
|
23
|
-
o.onChange.call(this, element);
|
24
|
-
}
|
25
|
-
}, o.delay);
|
26
|
-
});
|
27
|
-
});
|
28
|
-
};
|
29
|
-
|
30
|
-
$.fn.delayedChange.defaultOptions = {
|
31
|
-
delay: 700,
|
32
|
-
onChange: function(element) { }
|
33
|
-
}
|
34
|
-
|
35
|
-
$.fn.delayedChange.oldVal = 'NO_DELAYED_CHANGE_VALUE';
|
36
|
-
|
37
|
-
})(jQuery);
|