Here is a part of ag-grid JS code that filter cells with exactly text:
function doesExternalFilterPass(node) {
switch (status) {
case 'released':
return node.data.Status == 'Released';
case 'early-access':
return node.data.Status == 'Early access';
case 'in-development':
return node.data.Status == 'In development';
case 'rtt-strategy':
return node.data.Genre == /.'RTT'./;
default:
return true;
}
}
For example, one of the strings filter all cells containing Released in Status column, other containing RTT in Genre column. But I need that strings like RTT, RTS, Action also to be filtered. As I understand, I should use regular expressions, I try this
return node.data.Genre == /.'RTT'./;
but it doesn't work.
Any ideas to get many-words filtering?
String.prototype.includes() method: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
Example code:case 'rtt-strategy':
return node.data.Genre.includes('RTT');
RegExp.prototype.test() method: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test. First of all, you really should look up how to use regex in js, because your example code is way off. Secondly, example code:/RTT/.test(node.data.Genre)
Or if you want case insensitive, then:
/RTT/i.test(node.data.Genre)