title: Search spreadsheet and get rows
body: <p>I'm creating an app that can help find rows wich contains search query and show result in Ui. I have write this code, but something might be wrong and it don't works:</p>
  
  <pre><code> // Global variables
      var sh = SpreadsheetApp.getActiveSheet();
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var lastrow = ss.getLastRow();
      var lastcol = ss.getLastColumn();
  
   // Menu additions
      function onOpen() {
          var menuEntries = [{name: 'search', functionName: 'ui'}];
          ss.addMenu('Ui',menuEntries);
      }
  
   // UI
      function ui() {
          var app = UiApp.createApplication().setHeight('400').setWidth('900').setTitle('UI');
          var panel = app.add(app.createHorizontalPanel());
          var input = panel.createTextBox().setId('input').setFocus(true);
  
          panel.add(input).add(printBtn).add(saveBtn).add(emailBtn);
  
          var table = app.createFlexTable().setId('table').setBorderWidth(1).setCellPadding(1);
  
          var handler = app.createServerHandler('search');
          input.addChangeHandler(handler);
          handler.addCallbackElement(table);
  
          app.add(table);
          ss.show(app);
      }
  
      function search(e) {
          var app = UiApp.getActiveApplication();
          var table = app.getElementById('table');
          var query = e.toLowerCase();
  
          var data = sh.getRange(2,1,lastrow,lastcol).getValues();
          for (var row = 1; row &lt; data.length; row++) {
              for (var col = 0; col &lt; data[row].length; col++) {
  
                  if(data[row][col].toString().toLowerCase().match(e.toString()) == e.toString() &amp;&amp; e != '');
  
                  table.setText(row, col, data[row][col].toString());
           }
      }
  return app;
  }
  </code></pre>
  
  <p>Debugger says object <em>e</em> from function's <em>search</em> is undefined. Also I'm absolutely noob in js and simply don't know how to give this <em>e</em> parameter to function.</p>
  
  <p>Thank you in advance.</p>