Ok,
I have figured out more stuff since my last post (lets hope!)
So....here is my example code....not quite there yet.
<html>
<head>
<script src="../../runtime/lib/aw.js"></script>
<link href="../../runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>
<style>
</style>
<script>
var MyTable = AW.HTTP.Request.subclass();
MyTable.create = function(){
var obj = this.prototype;
obj._data = [];
obj._min = -1;
obj._max = -1;
obj._loading = false;
obj.getData = function(col, row){
if(this._data[row]){
return this._data[row][col];
}
this._min = this._min < 0 ? row : Math.min(row, this._min);
this._max = this._max < 0 ? row : Math.max(row, this._max);
if (!this._loading){
this._loading = true;
this.setTimeout(function(){
var startIndex = this._min > 20 ? this._min - 20 : 0;
var rowCount = this._max - this._min + 41;
this.setURL("index.php");
this.setParameter("offset", startIndex);
this.setParameter("limit", rowCount);
this.request();
}, 0);
};
return "";
}
obj.response = function(data){
if (!this._data.length){
this._data = [];
}
this._min = -1;
this._max = -1;
this._loading = false;
alert(data);
var startIndex = Number(this._startIndexParameter);
var rowCount = Number(this._rowCountParameter);
window.status = "Loaded rows " + startIndex + "-" + (startIndex+rowCount);
var i, j;
for (i=startIndex;i<startIndex+rowCount;i++){
this._data[i] = [];
for(j=0;j<20;j++){
this._data[i][j] = i + "." + j;
}
}
if (this.$owner){
this.$owner.setRowCount(1000);
this.$owner.refresh();
}
}
}
var table = new MyTable();
table.setParameter("offset", 0);
table.setParameter("limit", 50);
table.request();
var obj = new AW.UI.Grid;
obj.setColumnCount(10);
obj.setCellModel(table);
document.write(obj);
</script>
</body>
</html>
The original example did not have a table.setURL.
However, without the table.setURL, my index.php never gets called until I scroll.
So...I put one in that looks like this:
table.setURL("index.php");
Does that mean that I don't need the one further up in the code?
Anyway, now my index.php DOES get called and seems to return valid XML.
However, it seems like it is now stuck in an endless loop - just keeps calling my index.php over and over.
Is it something to do with the table.setParameter("limit", 50); ?
Also, I know I need to take out the example response and put in my real data instead, but I don't know if I need to parse the XML myself or if there is a function that will handle it for me?
If anyone can help, I would be most appreciative.
Thanks,
Jim