title: Setting default Value Inline Add Jqgrid
body: <p>Currently I have a requirement in a system where I need to repeat much of the data from the last row entered.
  Actualy this is my Grid: </p>
  
  <pre><code>$('#list').jqGrid({
          colNames: ['VendedorId', 'Vendedor', 'Especie', 'Cabezas', 'Kilos', 'Precio', 'Guías Venta', 'Vencimiento'],
          colModel: [
              { hidden: true, name: 'VendedorId' },
              { editable: true, width: 160, edittype: 'select', editoptions: { dataUrl: '/Clientes/CmbClientes' }, editrules: { required: true }, name: 'Vendedor' },
              { editable: true, width: 70, edittype: 'select', editoptions: { dataUrl: '/Especies/CmbEspecie' }, editrules: { required: true }, name: 'Especie' },
              { align: 'right', width: 50, editable: true, editoptions: { size: 3, maxlength: 3 }, editrules: { number: true }, formatter: 'number', formatoptions: { decimalPlaces: 0 }, name: 'Cabezas' },
              { align: 'right', width: 50, editable: true, editrules: { number: true }, formatter: 'number', formatoptions: { decimalPlaces: 0 }, name: 'Kilos' },
              { align: 'right', width: 50, editable: true, editrules: { number: true, required: true }, formatter: 'currency', formatoptions: { prefix: '$',decimalPlaces: 2  }, name: 'Precio' },
              { editable: true, width: 50, editoptions: { maxlength: 20 }, name: 'GuiasVenta' },
              { align: 'right', width: 70, editable: true, editoptions: { size: 3, maxlength: 3 }, editrules: { number: true, required: true }, formatter: 'number', formatoptions: { decimalPlaces: 0 }, name: 'Vencimiento' }
          ],
          url: '@Url.Action("ListVendedores")',
          datatype: 'json',
          editurl: '@Url.Action("SaveVendedor")',
          mtype: 'POST',
          pager: '#vendedoresPager',
          prmNames: { id: 'RemateId' },
          rowList: [5, 10, 15, 20],
          sortname: 'FeriaId',
          viewrecords: true,
          width: 850
      }).jqGrid('navGrid', '#vendedoresPager', { add: false, edit: false, del:true ), search: false },{},{},{ url: '/Remates/BorrarVendedor' }).
          jqGrid('inlineNav', '#vendedoresPager',
              {
                  add : true,
                  edit : true,
                  save : true,
                  addParams: {
                      addRowParams: {
                          position: "afterSelected",
                          keys: true,
                          extraparam: {
                              ...
                          }
                      }
                  },
                  editParams: {
                      keys: true,
                      extraparam: {
                          ...
                      }
                  }
              });
  </code></pre>
  
  <p>When adding the first row no default data, but then fields Vendedor, Especie, Guías Venta and Vencimiento should repeat the last entered.</p>
  
  <p>In this scenario I imagine two possible solutions, one is using the event jqGridInlineEditRow, and the other is using autocomplete.
  Have read this <a href="https://stackoverflow.com/questions/8872863/how-to-set-default-values-if-row-is-added-using-inline-add-button-in-jqgrid">Question about qGridInlineEditRow</a>. But in this case as I can get the data from the last row of the grid and how it should load the data into the new row.
  And read this <a href="https://stackoverflow.com/questions/12790123/jqgrid-inline-edit-odd-behavior-with-an-autocomplete-column">Question about autocomplete</a>.</p>
  
  <p>Maybe there other solutions that can read to get a better approximation to the solution.</p>
  
  <p>Can anyone help?</p>
  
  <p><strong>update 15/04/2013</strong></p>
  
  <p>i replace the Add button for a custom button this is the code:</p>
  
  <pre><code>    $("#Agregar").click(function () {
      var parameters =
          {
              initdata: {},
              position: "first",
              useDefValues: true,
              useFormatter: false,
              addRowParams: {
                  keys: true,
                  extraparam: {
                      ...
                  },
                  aftersavefunc: function (rowid) {
                      var grid = jQuery('#vendedores');
                      lastSavedAddData = grid.jqGrid("getRowData", rowid);
                  },
                  oneditfunc: function (rowid) {
                      var name;
                      var grid = jQuery('#vendedores');
                      for (name in lastSavedAddData) {
                          if (lastSavedAddData.hasOwnProperty(name)) {
                              $('#' + rowid +"_"+  name).val(lastSavedAddData[name]);
                          }
                      }
                  }
              }
          };
      jQuery("#vendedores").jqGrid('addRow', parameters);
  });
  </code></pre>
  
  <p>But this work only for text box but not for a combo</p>