Server side sorting and paging
I'm attempting to implement server side paging which means that sorting also has to uccur on the server side. I browsed this forum and found out that I can "override" the client side sort with my own logic so I wrote the following. Owever, when my "SortFunction" is invoqued, it complains that setURL is not valid:
var iCurrentSortIndex = 0;
var strCurrentSortDir = "";
var iCurrentPage = 1;
var SortFunction = function(src){
var iSortIndex = src.getProperty("item/index");
var strSortDir = src.getProperty("sort/direction");
if (iSortIndex != iCurrentSortIndex) { strSortDir = "ascending";
} else if (strCurrentSortDir == "descending") { strSortDir = "ascending";
} else { strSortDir = "descending"; }
this.setProperty("sort/index", iSortIndex);
this.setProperty("sort/direction", strSortDir);
var strURL = "FetchData.aspx?pageNumber=" + iCurrentPage;
strURL += "&sortBy=" + iCurrentSortIndex;
strURL += "&sortDir=" + strCurrentSortDir;
this.setURL(strURL);
this.request();
iCurrentSortIndex = iSortIndex;
strCurrentSortDir = strSortDir;
};
obj.setAction("columnSort", SortFunction);
var iCurrentSortIndex = 0;
var strCurrentSortDir = "";
var iCurrentPage = 1;
var SortFunction = function(src){
var iSortIndex = src.getProperty("item/index");
var strSortDir = src.getProperty("sort/direction");
if (iSortIndex != iCurrentSortIndex) { strSortDir = "ascending";
} else if (strCurrentSortDir == "descending") { strSortDir = "ascending";
} else { strSortDir = "descending"; }
this.setProperty("sort/index", iSortIndex);
this.setProperty("sort/direction", strSortDir);
var strURL = "FetchData.aspx?pageNumber=" + iCurrentPage;
strURL += "&sortBy=" + iCurrentSortIndex;
strURL += "&sortDir=" + strCurrentSortDir;
this.setURL(strURL);
this.request();
iCurrentSortIndex = iSortIndex;
strCurrentSortDir = strSortDir;
};
obj.setAction("columnSort", SortFunction);
February 7,