wardn
March 15, 2013, 10:19am
#1
Hi,
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 dhtmlx.com/docs/products/dht … aging.html but no succes
Can anyone help me?
Thanks
Unfortunately the issue cannot be reconstructed locally.
Please, provide any kind of sample of your code.
wardn
March 20, 2013, 7:16am
#3
Here is my code:
var myDHTMLX_tasks;
var qrytasks;
function Load_tasks() {
myDHTMLX_tasks = new dhtmlXGridObject('DHTMLX_tasks');
myDHTMLX_tasks.setImagePath('../../dhtmlx/roze/imgs/');
myDHTMLX_tasks.enableAutoHeight(true);
myDHTMLX_tasks.setEditable(false);
myDHTMLX_tasks.attachEvent("onBeforeSorting", sorttasksOnServer);
myDHTMLX_tasks.init();
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');
myDHTMLX_tasks.setPagingSkin('bricks');
qrytasks = '../dhtmlx/grid.ashx';
myDHTMLX_tasks.loadXML(qrytasks, function () {
if (myDHTMLX_tasks.getRowsNum() == 0) {
$("#DHTMLX_tasks").hide()
} 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;
}
Thanks
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=“it.softecspa.jwebber.bo.Utente”%>
<%@page import=“java.util.Hashtable”%>
<%@page import=“it.softecspa.mvc.MVCGenericServlet”%>
<%@page import=“it.softecspa.mvc.session.Session”%>
<%
Session webApplSession = (Session) session
.getAttribute(MVCGenericServlet.SESSIONPARAMETER);
Hashtable fod = (Hashtable) request
.getAttribute(MVCGenericServlet.REQUESTPARAMETER);
Utente utente = (Utente) webApplSession.getUser();
Locale currentLocale = null;
ResourceBundle bundle = null;
if (utente.getLanguage() != null) {
currentLocale = new Locale(utente.getLanguage(), utente
.getLanguage().toUpperCase());
bundle = ResourceBundle.getBundle(
Parameters.getInstance().APPLICAZIONE, currentLocale,
Thread.currentThread().getContextClassLoader());
}
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 {
%>
<%
}
%>[/code]
Unfortunately the issue still cannot be reproduced locally.
Here is the working example:
dhtmlx.com/docs/products/dht … aging.html
If issue still occur for you - please, provide us with a demo-link where the issue can be reproduced.
wardn
March 27, 2013, 7:00am
#7
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:
mygrid.clearAll(true).
In case of server-sorting there is no need to send the head section the second time.