Paging - Sorting - Dynamic Loading


I’m currently using the datagrid with paging and dynamic loading. Everything works fine, but when I want to use server side sorting I have a problem.

I have 193 records in total, the first 2 pages are loaded dynamicly. When I go to the 3th page it loads those records. That’s fine.
But when I first sort the grid (server side), then only the first 2 pages are loaded, when I go to the 3th page it doesn’t do anything.

No request for new data. When I don’t sort the grid at first and then go to the 3th page it sends a request for data.

I followed the example like … aging.html but no succes

Can anyone help me?

Unfortunately the issue cannot be reconstructed locally.
Please, provide any kind of sample of your code.

Here is my code:

var myDHTMLX_tasks;
var qrytasks;

function Load_tasks() {
myDHTMLX_tasks = new dhtmlXGridObject('DHTMLX_tasks');
myDHTMLX_tasks.attachEvent("onBeforeSorting", sorttasksOnServer);
myDHTMLX_tasks.attachEvent("onBeforePageChanged", function (ind,count) {
if (!this.getRowsNum())
return false;
return true;

myDHTMLX_tasks.enablePaging(true, 25, null, 'DHTMLX_tasks_paging', true, 'DHTMLX_tasks_info');
qrytasks = '../dhtmlx/grid.ashx';

myDHTMLX_tasks.loadXML(qrytasks, function () {
if (myDHTMLX_tasks.getRowsNum() == 0) {
} else {
myDHTMLX_tasks.setSortImgState(true, myDHTMLX_tasks.getColIndexById(26), 'ASC');


function sorttasksOnServer(columnIndex, sortType, sortDirection) {
myDHTMLX_tasks.clearAndLoad(qrytasks + '&orderby=' + myDHTMLX_tasks.getColumnId(columnIndex) + '&direct=' + sortDirection, function () {
myDHTMLX_tasks.setSortImgState(true, columnIndex, sortDirection);
return false;


Hi sematik,

Can you reproduce it?

i have this probelm too.

Here’s my code:

[code]<%@page import=“it.softecspa.portal.db.Dominio”%>
<%@page import=“it.softecspa.jwebber.CMSConstants”%>
<%@page import=“it.softecspa.portal.db.Configuratore”%>
<%@page import=“it.softecspa.portal.db.UtentePortale”%>
<%@page import=“it.softecspa.portal.Parameters”%>
<%@page import=“java.util.ResourceBundle”%>
<%@page import=“java.util.Locale”%>
<%@page import=“”%>
<%@page import=“java.util.Hashtable”%>
<%@page import=“it.softecspa.mvc.MVCGenericServlet”%>
<%@page import=“it.softecspa.mvc.session.Session”%>
Session webApplSession = (Session) session
Hashtable fod = (Hashtable) request
Utente utente = (Utente) webApplSession.getUser();
Locale currentLocale = null;
ResourceBundle bundle = null;
if (utente.getLanguage() != null) {
currentLocale = new Locale(utente.getLanguage(), utente
bundle = ResourceBundle.getBundle(
Parameters.getInstance().APPLICAZIONE, currentLocale,
UtentePortale ut_portale = UtentePortale.getActiveInstance(
webApplSession, utente.getIdUtente());
String CMSAdminRoot = (String) fod.get(CMSConstants.CMS_ADMIN_ROOT);
String channel_id = (String) fod.get(“channel_id”);
Configuratore configuratore = Configuratore.getInstance();
Parameters param = Parameters.getInstance();
Dominio dominio = null;
boolean gestisce_Aree = false;
if (ut_portale.getIdDominio() != 0) {
dominio = new Dominio(ut_portale.getIdDominio());
gestisce_Aree = dominio.isMngVettori();
String strWarning = fod.get(CMSConstants.WARNING_MESSAGE) != null ? (String) fod
.get(CMSConstants.WARNING_MESSAGE) : “”;
if (“ok”.equals((String) fod.get(CMSConstants.USER_CAN_PROCEDE))) {

} // non è andato a buon fine qualcosa quindi carico la pagina di errore
else {


Unfortunately the issue still cannot be reproduced locally.
Here is the working example: … aging.html

If issue still occur for you - please, provide us with a demo-link where the issue can be reproduced.

I’ve done some testing and I found that the problem is with sending the head section in the .NET connector.
When I send the sorting paramater then I disable the head section, then it works fine.

Is this correct or will I have some other problems because of that?

thank you it also works for me.
You have to send the total count but not the head section.

In case of loading header from the xml the previous header should be cleared:
In case of server-sorting there is no need to send the head section the second time.