title: jqGrid - inline edit and trapping edit rules
body: <p>In my situation, I need to allow users to edit various cells in the grid and then save the whole grid to the server later.  I have pretty much solved this issue with inline editing and saving to ‘clientArray’.  However, I am trying to use the editRules and have run into some issues.</p>
  
  <p>If I make a column editable, and use edit rules to require it to be a number</p>
  
  <pre><code>{ name: 'Value', index: 'Value', width: 50, sortable: true,edittype: 'text',
                   editable: true, editoptions: { maxlength: 10 },
                   editrules:{number: true},
                   formatter:currencyFmatter, unformat:unformatCurrency },
  </code></pre>
  
  <p>and I control editing and saving in the <code>onSelectRow</code> event:</p>
  
  <pre><code>onSelectRow: function(id){
      if(id &amp;&amp; id!==lastSel){
          jQuery("#Groups").saveRow(lastSel,true,'clientArray');   
          jQuery("#Groups").editRow(id,true);
      }  
      lastSel=id
  },
  </code></pre>
  
  <p>I then use a button click event to save the grid. Everything works great untill I put a non-numeric value into the Value cell then click on the row below it.  It throw as warning box up and stop the save, but it does not stop me from changing rows.  So I now have two rows open for editing.  Is there a way to trap the editrule error so I can handle it before moving to the next row.<br>
  I have tried to use the functions with saveRow (succesfunc, aftersavefunc, errorfunc, afterrestorefunc), of which all say fire after data is saved to server, which does not appear to work for ‘clientArray’.</p>
  
  <p>Basically, I need to find a way to validate the data in inline editing when saved to ‘clientArray’  and information, suggestions, and particularly, examples would be greatly appreciated.</p>
  
  <p>Thanks.</p>
  
  <hr>
  
  <p>After playing for awhile, I decided edit rules dont work so well with inLine Editing. So, as you suggested, I made my own validation routine.  The trick was figuring out how to get the value of the edited row. </p>
  
  <p>The one thing I am trying to figure out now is how to get the focus to go back to the Value column.  Back to the documentation!</p>
  
  <pre><code>              if(id &amp;&amp; id!==lastSel){
                          //dont save if first click
                          if (lastSel != -1) {
                            //get val of Value to check
                            var chkval = jQuery("#"+lastSel+"_Value").val() ;
                            // verify it is a number
  
                            if (isNaN(chkval)) {//If not a number
              //Send Validation message here
  
                                  //Restore saved row
                                  jQuery("#Grid").restoreRow(lastSel);
                                  //Return to failed save row
                                  jQuery("#Grid ").setSelection(lastSel,false);
                                  //reopen for editing
                                 jQuery("#Grid ").editRow(lastSel,true);
                                  //Note - dont reset lastSel as you want to stay here }
                            else {
                               // If number is good, proceed to save and edit next
                                  jQuery("#Grid ").jqGrid('saveRow',lastSel, checksave, 'clientArray', {}, null, myerrorfunc);        
                                  jQuery("#Grid ").editRow(id,true);
                                  lastSel=id;
                                  };
                              isDirty = true;
                              };
                          else {
                              //first click - open row for editing
                              alert("new Edit")
                              jQuery("#Grid ").editRow(id,true); 
                              lastSel=id;}
                              }  
  </code></pre>