Cliclking header in Big Data grid

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.

I think this is not enough to explain my situation. So I post my development environment

I’m using struts2 and mysql. and here’s my javascript.

[b]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?"&sortC="+sortC+"&sortD="+sortD+"&pageCnt=5";
		swgrid.clearAndLoad(params);
	}[/b]

here’s my xml for grid.

<%@ page language=“java” contentType=“text/xml; charset=UTF-8” pageEncoding=“UTF-8”%>

<s:if test=“softwareList.size > 0”>
<s:iterator value="%{softwareList}" status=“index”>

<s:property value="%{SW_NM}" />
<s:property value="%{SW_COMPANY}" />
<s:property value="%{SW_VER}" />
<s:property value="%{INST_DT}" />

</s:iterator>
</s:if>

here’s my query
//get total count from softwarelist

SELECT IFNULL(COUNT(*), 0)
FROM T_PC_SW_LIST sl
JOIN T_SOFTWARE so ON sl.SW_SEQNO = so.SW_SEQNO

//get real data from softwarelist

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#

If anyone have solution please help me…

You may try to save the current page before the sorting using the getStateOfView() method:
var page=swgrid.getStateOfView()[0]

and then go to a saved page after the sorting is done:
swgrid.changePage(page);