title: jqGrid onDelete event handler
body: <p>I'm using a jqGrid with <code>datatype: 'local'</code>. The data of the grid is being set dynamically via <code>addRowData</code>.
  I don't use the asynchronous ajax stuff such as <code>url</code> + <code>datatype: json</code> because the grid has to display only client state.</p>
  
  <p>Now I want to use the jqGrid delete row functionality (<code>delbutton: true</code>), which calls the <code>delGridRow</code> function. This removes the row just fine, but of course I need to remove the underlying data. Since all of this is just client, I cannot use the <code>editurl</code>.</p>
  
  <p>What I want, is a <code>onRowDelete</code> or <code>onRowEdited</code> event. But jqGrid does not support such a thing, or at least I haven't found any such thing. Implementing my own delete button would be fine, but I only managed to do this via the toolbar which isn't what I want.</p>
  
  <p>After much, much fiddling I came up with the following solution to add my own event handler to jqGrid:</p>
  
  <pre><code>    var originalDelFunc = $.fn.jqGrid.delGridRow;
      $.fn.jqGrid.delGridRow = function (rowids, oMuligrid) {
          var onPreDeleteRowEventHandler = this.getGridParam('onPreDeleteRow'),
              consumeFlag = false;
          if (typeof onPreDeleteRowEventHandler === 'function') {
              consumeFlag = !!onPreDeleteRowEventHandler(rowids, oMuligrid);
          }
  
          if (!consumeFlag) {
              originalDelFunc.call(this, rowids, oMuligrid);
          }
      };
  </code></pre>
  
  <p>usage:</p>
  
  <pre><code>    grid.jqGrid(
          'setGridParam',
          {
              onPreDeleteRow: function(rowids, oMuligrid) {
                  // remove client data here
              }
          });
  </code></pre>
  
  <p>Now, my question is: why is this so complicated? Am I missing something here? Is this solution viable, or is it likely to break with future versions?</p>