Skip to content

Commit

Permalink
use the ternary operator
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Jan 18, 2024
1 parent bbde923 commit b56cc64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: DT
Type: Package
Title: A Wrapper of the JavaScript Library 'DataTables'
Version: 0.31.2
Version: 0.31.3
Authors@R: c(
person("Yihui", "Xie", email = "[email protected]", role = c("aut", "cre")),
person("Joe", "Cheng", role = "aut"),
Expand Down
10 changes: 3 additions & 7 deletions inst/htmlwidgets/datatables.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,15 +530,11 @@ HTMLWidgets.widget({
var fun = function() {
searchColumn(i, $input.val()).draw();
};
// throttle searching for server-side processing
var throttledFun = $.fn.dataTable.util.throttle(fun, options.searchDelay);
$input.on('input', function(e, immediate) {
if (immediate) {
fun(); // Allows updateSearch to bypass throttling.
} else if (server) {
throttledFun();
} else {
fun();
}
// always bypass throttling when immediate = true (via the updateSearch method)
(immediate || !server) ? fun() : throttledFun();
});
} else if (inArray(type, ['number', 'integer', 'date', 'time'])) {
var $x0 = $x;
Expand Down

0 comments on commit b56cc64

Please sign in to comment.