Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Keith Tyler on Dec 31, 2008 13:31
open dhtmlx forum
splitAt() and Server side sorting

I get the following error "Microsoft JScript runtime error: 'this.hdr.rows.0.childNodes' is null or not an object"

when I do a server side sort on a column that is in the splitAt window. If I click on any other column the function works fine.
Using splitAt(2) if I sort on either of the first two columns I get the error. If I use any other column it works fine.

function sortGridOnServer(ind, gridObj, direct) {
if (direct == "asc") {
orderBy = mygrid.getColumnId(ind);
orderDirection = "ASC";
}
else {
orderBy = mygrid.getColumnId(ind);
orderDirection = "DESC";
}



var processData = createelementxml("account", document.getElementById("loadedaccounts").value) +
createelementxml("filter", document.getElementById("reviewoption").value) +
createelementxml("orderby", orderBy + " " + orderDirection);

responseString = CallProcess("getassets", processData);

var oxmldoc = createxmldocument(responseString);
window.status = "";
var status = oxmldoc.documentElement.selectSingleNode("rspdata/status").text;
if (status != "0") return;
var assetCount = oxmldoc.documentElement.selectSingleNode("rspdata/assetcount").text;

var xmlString = oxmldoc.documentElement.selectSingleNode("rspdata/assetlist/rows").xml;

mygrid = new dhtmlXGridObject('masterlist');
mygrid.setImagePath("dhtmlx/dhtmlxGrid/codebase/imgs/");
mygrid.setSkin("gray");
mygrid.enableSmartRendering(true, 50);
mygrid.enableEditEvents(true, true, true);
mygrid.attachEvent("onMouseOver", doOnRowSelect);
mygrid.attachEvent("onEditCell", doCellChanged);
mygrid.attachEvent("onRightClick", distributeSelected);
mygrid.attachEvent("onBeforeSorting", sortGridOnServer);
mygrid.setDateFormat("m-d-y");
mygrid.enableColumnMove(true);
mygrid.enableAutoSizeSaving();
mygrid.enableOrderSaving();


mygrid.attachEvent("onAfterCMove", function(a, b) {
colId = mygrid.getColIndexById("Security_Cd");
mygrid.setSubTree(tree, colId, 0);
return true;
});

mygrid.setSubTree(tree, 4, 0);

mygrid.splitAt(2);
mygrid.init();

mygrid.loadXMLString(xmlString, function() {

mygrid.setColSorting("server,server,server,server,server,server,server,server,server,server,server,server,server,server,server,server,server,server");
mygrid.setSortImgState(true, ind, direct);
mygrid.loadSizeFromCookie();
mygrid.loadOrderFromCookie();

});


dataChanged = false;

return false;
}
Answer posted by Support on Jan 07, 2009 16:01
Which version of dhtmlxgrid you are using?
Please be sure that what server side response generated on data reloading request contains only data part and not contains head section ( head section will cause full grid reconstruction which will be fatal in case of split usage )