example/highlight.js
function updateExpression() {
  // Default highlighter will not highlight anything
  var nullHighlighter = function(item) { return false; }

  var input = $('.expression');
  var expression = input.val();

  var highlighter;

  if (!expression) {
    // No expression specified. Don't highlight anything.
    highlighter = nullHighlighter;
    input.css('background-color', '#fff');
  } else {
    try {
      // Build highlighter from user's expression
      highlighter = compileExpression(expression); // <-- Filtrex!
      input.css('background-color', '#dfd');
    } catch (e) {
      // Failed to parse expression. Don't highlight anything.
      highlighter = nullHighlighter;
      input.css('background-color', '#fdd');
    }
  }

  highlightRows(highlighter);
}
function updateExpression() {
  // Default highlighter will not highlight anything
  var nullHighlighter = function(item) { return false; }

  var input = $('.expression');
  var expression = input.val();

  var highlighter;

  if (!expression) {
    // No expression specified. Don't highlight anything.
    highlighter = nullHighlighter;
    input.css('background-color', '#fff');
  } else {
    try {
      // Build highlighter from user's expression
      highlighter = compileExpression(expression); // <-- Filtrex!
      input.css('background-color', '#dfd');
    } catch (e) {
      // Failed to parse expression. Don't highlight anything.
      highlighter = nullHighlighter;
      input.css('background-color', '#fdd');
    }
  }

  highlightRows(highlighter);
}
function updateExpression ( ) { // Default highlighter will not highlight anything var nullHighlighter = function ( item ) { return false ; } var input = $ ( '.expression' ) ; var expression = input . val ( ) ; var highlighter ; if ( ! expression ) { // No expression specified. Don't highlight anything. highlighter = nullHighlighter ; input . css ( 'background-color' , '#fff' ) ; } else { try { // Build highlighter from user's expression highlighter = compileExpression ( expression ) ; // <-- Filtrex! input . css ( 'background-color' , '#dfd' ) ; } catch ( e ) { // Failed to parse expression. Don't highlight anything. highlighter = nullHighlighter ; input . css ( 'background-color' , '#fdd' ) ; } } highlightRows ( highlighter ) ; }
When user entered expression changes, attempt to parse it
and apply highlights to rows that match filter.
When user entered expression changes attempt to parse it and apply highlights to rows that match filter .