XML and Paging
It is possible to page xml data on client side, this stuff is awesome, for those who are wondering, here is how
Include the ActiveWidgets/patches/paging1.js in your html file and..
that's it...
Include the ActiveWidgets/patches/paging1.js in your html file and..
var data = new Active.XML.Table;
var obj = new Active.Controls.Grid;
data.setText = function(value, i, j){
var node = this.getNode(i, j);
node.text = value; }
// Page returning xml
data.setURL("jsps/"+GridType+".jsp");
obj.setId(GridType);
data.request();
var columns = ["Release ID","Package Name", "First Project ID", "ECM Number", "Repository Name", "Review ID", "Review Date", "Status", "DeveloperID"];
var defaultResponse = data.response;
data.response = function(data){
defaultResponse.call(this, data);
// replace the built-in row model with the new one (defined in the patch)
obj.setModel("row", new Active.Rows.Page);
obj.setProperty("row/count", this.getCount());
obj.setProperty("column/count", 9);
obj.setProperty("column/texts", columns);
// set page size
obj.setProperty("row/pageSize", 10);
goToPage(0,obj,GridType+'Lbl');
}
function goToPage(delta,obj,lbl){
var rowCount = obj.getProperty("row/count");
var count = obj.getProperty("row/pageCount");
var number = obj.getProperty("row/pageNumber");
number += delta;
if (number < 0) {number = 0}
if (number > count-1) {number = count-1}
document.getElementById(lbl).innerHTML = "Page <b>" + (number + 1) + "</b> of <b>" + count + "</b>"
document.getElementById(lbl+'Rows').innerHTML = "Total Rows <b>"+ rowCount +"</b>";
obj.setProperty("row/pageNumber", number);
obj.refresh();
}
that's it...
satch
November 17,