title: Reloading a struts jqGrid with a form submission
body: <p>I have a struts2 jgrid that I wish to be able to refresh the information using a form submission button. I have been trying to follow this (SO post) [<a href="https://stackoverflow.com/questions/13218775/dynamic-data-reload-to-struts2-jquery-grid-on-form-submit">dynamic data reload to struts2 jquery grid on form submit</a> ] but am a bit confused with why my process is not working as expected. The action updateRPJson returns json type as a response, and the gridmodel has all of the getters/setters and attributes needed to work.</p>
  
  <p>Upon first loading the web-page containing this grid, the action method is invoked and the information is correctly retrieved. I am expecting the "Refresh" button present inside of the form to send the information from the form to the action class, and then repopulate the grid with the response it receives. I thought the refresh button would publish the "reloadMyGrid" topic, which would then force the grid to reload causing the action to be invoked from the href of the grid. I added console.log statements to determine what was being called and what was not, as well as added breakpoints inside of my action class to see when it was being invoked.</p>
  
  <p>I discovered that upon clicking the refresh button, the console recieves "Test2" indicating that reloadMyGrid is "published" (I don't think that is the right term), however my action class is never being called. The lack of "Test" in the console indicates that the form itself is also not being submitted.</p>
  
  <p>If I were to change the form button back to an <code>&lt;sj:submit/&gt;</code> and change the forms <code>onSubmit</code> to <code>action=updateRPJson</code>, the page displays the correct information as pure json (and not inside of the grid). This leads me to believe that should the action be invoked after clicking the button, this would work, and is not an issue with the action itself. </p>
  
  <p>I realize this is a long-winded somewhat specific case question, but any insight on how the process of updating a struts jqgrid with a form submission button would be appreciated, as I am not fully understanding the post I linked above I'm assuming.</p>
  
  <p>Tags:</p>
  
  <pre><code>&lt;%@ page contentType="text/html; charset=UTF-8"%&gt;
  &lt;%@ taglib prefix="s" uri="/struts-tags"%&gt;
  &lt;%@ taglib prefix="sj" uri="/struts-jquery-tags"%&gt;
  &lt;%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %&gt;
  </code></pre>
  
  <p>Form:</p>
  
  <pre><code>&lt;s:form id="getRPInstance" name="getRPInstance"  onSubmit="return reloadGrid();" &gt;
      &lt;div class="type-text" align="center" style="width:50%;text-align:right;float:left"&gt;
                  &lt;s:select
                     name="location"
                     id="location"
                     list="#{'unit':'Unit', 'acceptance':'Acceptance', 'integration':'Integration','production':'Production'}"
                     value="%{#session.location}"
                     required="true"/&gt;
                  &lt;s:select
                      name="realm"
                      id="realm"
                      list="#{'int':'Internal', 'ext':'External', 'cld':'Cloud' }"
                      value = "%{#session.realm}"
                      required = "true"/&gt;
                  &lt;div id="buttonDiv" class="type-button" align="center"&gt;
                      &lt;sj:a button="true" onClickTopics="reloadMyGrid"&gt;Refresh&lt;/sj:a&gt;
                  &lt;/div&gt;
      &lt;/div&gt;
  &lt;/s:form&gt;
  </code></pre>
  
  <p>Scripts:</p>
  
  <pre><code>
      &lt;script&gt;
  
      $.subscribe('reloadMyGrid',function()
      {
          console.log("Test2");
          $( '#gridError' ).html( "" );
      });
  
      function reloadGrid() {
           console.log("Test");
           $('#gridtable').trigger('reloadMyGrid');
           return false;
       }
      &lt;/script&gt;
  
  </code></pre>
  
  <p>Grid:</p>
  
  <pre><code>
      &lt;s:url var="remoteurl" action="updateRPJson"/&gt;
      &lt;sjg:grid
          id="gridtable"
          caption="Reverse Proxy"
          dataType="json"
          href="%{remoteurl}"
          pager="true"
          gridModel="proxies"
          rowList="10,15,20,50"
          rowNum="20"
          rownumbers="true"
          reloadTopics="reloadMyGrid"
          formIds="getRPInstance"
          height="600"
          width="650"
          loadonce="true"
      &gt;
          &lt;sjg:gridColumn name="name" index="name" title="Name" key="true" hidden="true" sortable="false"/&gt;
          &lt;sjg:gridColumn name="label" index="label" title="Label" sortable="true"/&gt;
      &lt;/sjg:grid&gt;
  
  </code></pre>