title: calling a javascript function in onClick
body: <p>When i deploy my code it gives me an error:
  saveRows is not a function
  So what's wrong ?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>dataGrid.prototype = {
        display: function() {
          var self = this;
          var html = [];
          var check = 0;
          var lastSelection;
          html.push("&lt;div style='margin-left:20px'&gt;");
          html.push("&lt;input class='btn btn-default' type='button' value='Save All Rows' onclick='saveRows()'' /&gt;");
          html.push("&lt;table id='" + this.id + "" + "'class='table'&gt;\n&lt;/table&gt;");
          html.push("&lt;div id='pagger_" + this.id + "'&gt;&lt;/div&gt;");
          html.push("&lt;/div&gt;");
          $('body').append(html.join(""));
          $("#" + this.id).jqGrid({
            // ...
          });
        },
        // ...
        saveRows: function() {
          var ids = $("#" + this.id).jqGrid('getDataIDs');
          for (var i = 0; i &lt; ids.length; i++) {
            $("#" + this.id).jqGrid('saveRow', ids[i]);
          }
        }
      };</code></pre>
  </div>
  </div>
  </p>
  
  <p>so any other suggestions ??</p>