Skip to content

Commit

Permalink
support jQuery.grep in serverside FieldCalculations
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrenn committed Jun 18, 2024
1 parent 3ceab9d commit 949021c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/src/main/resources/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ if (!String.prototype.trim) {
jQuery.trim = function(str) {
return (str != null ? str.trim() : null);
};
jQuery.grep = function(elems, callback, invert) {
var callbackInverse,
matches = [],
i = 0,
length = elems.length,
callbackExpect = !invert;

// Go through the array, only saving the items
// that pass the validator function
for (; i < length; i++) {
callbackInverse = !callback(elems[i], i);
if (callbackInverse !== callbackExpect) {
matches.push(elems[i]);
}
}

return matches;
};
var console = {
log : function(msg) {
java.lang.System.out.println(msg);
Expand Down

0 comments on commit 949021c

Please sign in to comment.