Load XML repeatedly fire the trigger on mouse scrolling..

Load XML repeatedly fire the trigger on mouse scrolling…
Please check the below code. when the page is load for a first time, first 50 data is coming. and after rendering the 50 records again (on mouse scrolling)it goes to ajax page to fire the query for next 50 data. but it is repeatedly firing…

lazyGrid = new dhtmlXGridObject(‘gridbox’);
lazyGrid.setImagePath("…/codebase/imgs/");
lazyGrid.setHeader(“Date,RSN,PickSelct,Number”);
lazyGrid.setColumnIds(“D04,F01,C10,N01”);
lazyGrid.enableValidation(“true,true,false,true”); lazyGrid.setColValidators(“isDate,isFloat,isNumber”);
lazyGrid.setInitWidths(“100,100,100,100”);
lazyGrid.setColAlign(“center,left,center,left”);
lazyGrid.setColSorting(“date,int,str,int”);
lazyGrid.setColTypes(“dhxCalendarA,ed,coro,ed”);
lazyGrid.setSkin(“dhtmlx”);
lazyGrid.init();
lazyGrid.enableEditEvents(true,false,false);
lazyGrid.enableSmartRendering(true, 50);
lazyGrid.enableMultiselect(true);

function loadLazyGrid(){
lazyGrid.clearAll();
lazyGrid.loadXML(“LazyLoading_AJAX.jsp?lid=1424234&command=retrieve”);
}

int startIndex = 0;
int endIndex = 50;
int totalListCount = 0;

if (JspAide.getRequestInt(“posStart”) != 0) // get Request
startIndex = JspAide.getRequestInt(“posStart”);
if (JspAide.getRequestInt(“count”) != 0)
endIndex = JspAide.getRequestInt(“count”);

if(startIndex==0) { //to get total number of record present
dwCount.setSelect_SELECT(“count(*) count”);
dwCount.setSelect_FROM(ePage.getTableName());
dwCount.setSelect_WHERE(where);
dwCount = JspAide.retrieve(dwCount);

if (dwCount.errorFlag) {				
	return "";
}
totalListCount = dwCount.getItemInt(1, "count");		
}else{
	totalListCount = 0;
}

}
dw.startIndex = startIndex; //fire the SQL to get the data
dw.endIndex = endIndex;
dw.setSelect_SELECT(*);
dw.setSelect_FROM(tablename);
dw.setSelect_WHERE(where);
dw = JspAide.retrieve(dw);

sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //create XML
sb.append("<rows total_count=""+totalListCount+"" pos=""+startIndex+"">");
for(int i=1; i<=dw.rowCount; i++){
sb.append("<row id=“r”+i+"" fRSN=“row”+i+"">");

}

You should pass “total_count” parameter only with first portion of rows. Please find more information about dynamic loading here docs.dhtmlx.com/doku.php?id=dhtm … _rendering
docs.dhtmlx.com/doku.php?id=dhtm … ep_by_step

Also you can try to use dhtmlxConnector extension to simplify server side operations related DHTMLX components. Please find more information here docs.dhtmlx.com/doku.php?id=dhtmlxconnector:toc