title: jqGrid: How To Delete Row/s From "navButtonAdd" And "delGridRow"?
body: <p>I've encountered a problem with jqGrid datagrid.
  I need to delete one row or more with a button "Delete".
  Here my code:</p>
  
  <pre><code>$grid.navGrid('#pager', { edit: false, add: false, del: false, search: false });
  $grid.navButtonAdd('#pager', {
      caption: "Delete",
      buttonicon: "ui-icon-del",
      position: "last",
      onClickButton: function() {
          alert("Deleting Row");
          row_ids = $grid.getGridParam('selarrrow');
          $grid.delGridRow(row_ids, {
              dataType: 'json',
              mtype: 'GET',
              url: '&lt;?php echo $_SERVER['PHP_SELF'].'?app=my_app&amp;action=record_delete'; ?&gt;'
          });
      }
  });
  </code></pre>
  
  <p>This snippet of code send to the "url:" option the id/s of selected row/s (it works).
  That url return a response, in json format.. This answer say if the operation was successful or not.
  I need to display an alert with that message, how do I do?
  And, another problem, when I click on "Delete" button (on bottom of the jqGrid), it displays an ajax windows with the question "Do you want to delete selected items?", with the "Yes" input and the "No" input. When I click "Yes", this ajax window will not close!</p>
  
  <p>Thank you!</p>
  
  <p>Dante</p>
  
  <p>EDIT [1] &amp;&amp; [2]</p>
  
  <pre><code>$(document).ready(function()
  {
      $grid = $("#list");
      fixPositionsOfFrozenDivs = function() {
          if (typeof this.grid.fbDiv !== "undefined") {
              $(this.grid.fbDiv).css($(this.grid.bDiv).position());
          }
          if (typeof this.grid.fhDiv !== "undefined") {
              $(this.grid.fhDiv).css($(this.grid.hDiv).position());
          }
      };
  
      $grid.jqGrid({
          url: '&lt;?php echo $_SERVER['PHP_SELF'].'?app=my_app&amp;option=get_records'; ?&gt;',
          datatype: 'json',
          mtype: 'GET',
          height: 'auto',
          width: window.innerWidth-35, //width: '1225',
          colNames: ['ID', 'Column A', 'Column B', 'Column C', 'Column D'],
          colModel: [
              { name: 'id', index: 'id', width: 130, align: 'center', search: true,
                  sortable: true, frozen: true, editable: true, edittype: 'text', formatter: 'showlink',
                  editoptions: { size: 130, maxlength: 50 }, stype: 'text' },
              { name: 'col_a', index: 'col_a', width: 250, align: 'left', search: true,
                  sortable: true, frozen: false, editable: true, edittype: 'text',
                  editoptions: { size: 250, maxlength: 40 }, stype: 'text' },
              { name: 'col_b', index: 'col_b', width: 120, align: 'left', search: true,
                  sortable: true, frozen: false, editable: true, edittype: 'text',
                  editoptions: { size: 120, maxlength: 40 }, stype: 'text' },
              { name: 'col_c', index: 'col_c', width: 100, align: 'right', search: true,
                  sortable: true, frozen: false, editable: true, edittype: 'text',
                  editoptions: { size: 100, maxlength: 40 }, stype: 'text' },
              { name: 'col_d', index: 'col_d', width: 100, align: 'right', search: true,
                  sortable: true, frozen: false, editable: true, edittype: 'text',
                  editoptions: { size: 100, maxlength: 6 }, stype: 'text' }
          ],
          caption: 'Objects',
          pager: '#pager',
          sortname: 'id',
          sortorder: 'ASC',
          rowNum: 25,
          rowList: [25, 50, 100, 200, &lt;?php echo $totrecords; ?&gt;],
          loadonce: true,
          gridview: true,
          viewrecords: true,
          rownumbers: true,
          rownumWidth: 40,
          toppager: true,
          multiselect: true,
          autoencode: true,
          ignoreCase: true,
          shrinkToFit: false,
          loadComplete: function() {
              $("option[value=&lt;?php echo $totrecords; ?&gt;]").text('All');
          },
          editurl: '&lt;?php echo $_SERVER['PHP_SELF'].'?app=my_app&amp;option=delete_records'; ?&gt;'
      });
  
      $grid.jqGrid('filterToolbar', {multipleSearch: false, stringResult: false, searchOnEnter: false, defaultSearch: 'cn'});
      $grid.navGrid('#pager', { edit: false, add: false, del: false, search: false });
      $grid.navButtonAdd('#pager', {
          caption: "Delete",
          buttonicon: "ui-icon-del",
          position: "last",
          onClickButton: function() {
              row_ids = $grid.getGridParam('selarrrow');
              $grid.delGridRow(row_ids, {
                  closeOnEscape: true,
                  mtype: 'POST',
                  afterSubmit: function(data_from_server, array_data) {
                      var result = data_from_server.responseText;
                      var message = eval('(' + result + ')');
                      alert(message.query);
                  }
              });
          }
      });
  
      $grid.jqGrid('setFrozenColumns');
      $grid[0].p._complete.call($grid[0]);
      fixPositionsOfFrozenDivs.call($grid[0]);
  
  });
  </code></pre>