title: dhtmlxGrid : Cliclking header in Big Data grid
body: <p>I'd like to maintain page location while click onto header.
  But if I'm in page 5 and click onto header then page location changed to 1 page.
  (sort is perfect) 
  I want maintain my page location if I click onto header in page 5, still maintain location
  5 page and sorting is perfectly.</p>
  
  <p>I think this is not enough to explain my situation. So I post my development environment</p>
  
  <p>I'm using struts2 and mysql. and here's my javascript.</p>
  
  <pre><code>function fnGridInitSW(){
  swgrid = new dhtmlXGridObject('swGridBox');
  swgrid.setImagePath("../../../common/img/dhtmlx/grid/");
  swgrid.setHeader("SoftWareName, company, version, Install_date");
  swgrid.setColumnIds(
      "COL_1"
      +",COL_2"
      +",COL_3"
      +",COL_4"
  );
  swgrid.setInitWidthsP("25,25,25,*");
  swgrid.setColTypes("ro,ro,ro,ro");
  swgrid.setColSorting("str,str,str,str");
  
  swgrid.attachEvent("onXLS", function(){
      $("#swnotfound").hide();
      $("#swgridLoading").show();
  });
  swgrid.attachEvent("onXLE", function(){
      $("#swgridLoading").hide();
      swgrid.changePage(chPg);
      $("#swnotfound").hide();
  });
  swgrid.init();
  swgrid.attachEvent("onBeforePageChanged",function(ind,count){
      chPg = count;
      if (!swgrid.getRowsNum()){
          return false;
      };
      return true;
  }); 
  var mygrid_state = swgrid.getSortingState();
  popFnSearch(swgrid.getColumnId(mygrid_state[0]), mygrid_state[1]);  
  // Custom Sorting
  swgrid.attachEvent("onBeforeSorting",function(ind, type, direction) {
      popFnSearch(swgrid.getColumnId(ind), direction);
      var sInd;
      var mygrid_state = swgrid.getSortingState(); 
      if( typeof(mygrid_state[0]) == "undefined" ){
          sInd = ind;
      }
      direction = (mygrid_state[1] == "des") ? "asc": "des";
      swgrid.setSortImgState(true,sInd,direction); 
      return true;
      });
  }
  function popFnSearch(sortC, sortD) {
      if( typeof(sortC) == "undefined" ) sortC = swgrid.getColumnId(3); 
      if( typeof(sortD) == "undefined" ) sortD = "desc";
  
      var params = "/url/Info.do?"&amp;sortC="+sortC+"&amp;sortD="+sortD+"&amp;pageCnt=5";
      swgrid.clearAndLoad(params);
  }
  </code></pre>
  
  <p>here's my xml for grid.</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/xml; charset=UTF-8" pageEncoding="UTF-8"%&gt;
  &lt;rows total_count='&lt;s:property value="%{totalCnt}" /&gt;' pos='&lt;s:property value="%{posStart}" /&gt;'&gt;        
      &lt;s:if test="softwareList.size &gt; 0"&gt;
          &lt;s:iterator value="%{softwareList}" status="index"&gt;
              &lt;row id="'index&lt;s:property value='%{SW_SEQNO}'/&gt;'"&gt;                                      
                  &lt;cell&gt;&lt;s:property value="%{SW_NM}" /&gt;&lt;/cell&gt; 
                  &lt;cell&gt;&lt;s:property value="%{SW_COMPANY}" /&gt;&lt;/cell&gt; 
                  &lt;cell&gt;&lt;s:property value="%{SW_VER}" /&gt;&lt;/cell&gt;               
                  &lt;cell class="last"&gt;&lt;s:property value="%{INST_DT}" /&gt;&lt;/cell&gt;
              &lt;/row&gt;
          &lt;/s:iterator&gt;
      &lt;/s:if&gt; 
  &lt;/rows&gt;
  </code></pre>
  
  <p>here's my query</p>
  
  <pre><code>//get total count from softwarelist
  &lt;select id="getSoftwareInfoTotCnt" resultClass="Integer" parameterClass = "d"&gt;
      SELECT IFNULL(COUNT(*), 0) 
      FROM T_PC_SW_LIST sl 
      JOIN T_SOFTWARE so ON sl.SW_SEQNO = so.SW_SEQNO
  &lt;/select&gt;
  //get real data from softwarelist
  &lt;select id="getSoftwareInfo" resultClass="c" parameterClass = "d"&gt;
      SELECT 
      sl.SW_SEQNO 
      , sl.ASST_SEQNO 
      , so.SW_NM 
      , so.SW_COMPANY 
      , so.SW_VER
      , DATE_FORMAT(sl.INST_DT, '%Y-%m-%d') AS INST_DT
      FROM T_PC_SW_LIST sl 
      JOIN T_SOFTWARE so ON sl.SW_SEQNO = so.SW_SEQNO
          ORDER BY $sortC$ $sortD$
          LIMIT #posStart# , #count#
  &lt;/select&gt;
  </code></pre>
  
  <p>If anyone have solution please help me..</p>