I love the grid and have purchased it (2.0). I really NEED ajax paging though. Do you have any idea as to when this might be available (even in beta... I'll test for you).
Basically, I need the grid to be able to batch some number of rows but I'll set an total row amount. If the user scrolls past the batched rows, an ajax callback happens (with a url that is set & parameters indicating desired rows) and then the grid displays the rows. Thanks, Alex.
Joe
Joe Hudson
Thursday, April 20, 2006
Joe,
from your description it looks more like virtual mode with incremental data uploading (in small chunks) and not paging in the traditional sense. If this is true, I will be able to make an example of customized data model. Tell me which data format you are going to use (json/xml/csv?).
Alex (ActiveWidgets)
Thursday, April 20, 2006
If I can do this now, that would be AWESOME!!!
I actually use array-based data. Here is an example of a grid:
So, if I initially loaded 25 rows into the grid but the dataset (in the database) had 1500 rows, how would that work? I assume I would call:
locationsGrid.setRowCount(1500);
But what is the code to do a server call to retrieve that data and add to the grid when the user scrolls past 25?
Thank you so much, Alex.
Joe
Joe Hudson
Thursday, April 20, 2006
I don't have complete working solution, but here is a small demo which may help you to start.
The grid calls table.getData(col, row) method for the the cells data. If particular row is missing than the table returns empty string and adds row index to the range of row indices to be retrieved. The table model then initiates the remote request passing the starting row and the number of rows to retrieve. When the data is received it is added to the main array and the grid is repainted.
For the purpose of this demo the actual request is replaced by simply 0.5 sec timeout and fake array data. In actual implementation you'd have to make JSON array on the server and eval it in table.response() callback.
// for demo only, should take from the returned data
var startIndex = Number(this._startIndexParameter);
var rowCount = Number(this._rowCountParameter);
for(j=0;j<20;j++){
// for demo only, should take from the returned data
this._data[i][j] = i + "." + j;
}
}
if (this.$owner){
this.$owner.setRowCount(1000); //should take from the returned data
this.$owner.refresh();
}
}
}
var table = new MyTable();
table.setParameter("startIndex", 0);
table.setParameter("rowCount", 50);
table.request();
var obj = new AW.UI.Grid;
obj.setColumnCount(10);
obj.setCellModel(table);
document.write(obj);
</script>
</body>
</html>
Alex (ActiveWidgets)
Thursday, April 20, 2006
I would also be extremely interested in this. We also deal with large data sets and if we could bring them in a page at a time that would be great. we use CSV.
In my case we are pulling data from a servlet in CSV forum. We would need a mechanism that would increment Page up, Page Down, beginning and end.
WeeJavaDude
Thursday, April 20, 2006
It should also work for CSV with minor changes. Current AW.CSV.Table parses the text into js array, so it is nearly the same.
Alex (ActiveWidgets)
Thursday, April 20, 2006
This is great. Thanks, Alex.
Is there any way, right now, that I could use the table.setParameter("rowCount", 50);
method to represent the whole set: table.setParameter("rowCount", 1500); and somehow have the grid to the callback when it hit a row that has not been loaded to avoid a full repaint... maybe could then do a row by row repaint and keep cursor position?
I have absolutely no idea how I would do this... is something that could be done currently with a script similar to the one above? I would be extremely grateful if you could show me how to do something like that. Thank you very much.
Joe
Joe Hudson
Thursday, April 20, 2006
Will this only work for v2? I am stuck with 1.0 for the time being.
Thanks
Nick
Monday, July 24, 2006
Result please an example without virtual demonstration.
In what kind the server should return data?
Thanks
Valeri
Sunday, February 11, 2007
Could you give an example of this using CSV? I am still confused.
Thanks
Rob
Thursday, June 7, 2007
I understand that I would replace the setURL with my url that is going to generate the XML.
However, I don't see anything that actually calls that URL. Do I need to replace the obj.request function code with my own code to make a call to that URL?
Could you give me some idea of what that might look like?
Thanks,
Jim
Jim Nickel
Wednesday, November 7, 2007
Ok,
I have figured out more stuff since my last post (lets hope!)
So....here is my example code....not quite there yet.
// this is here for debug to see what we get back
alert(data);
// How to process the XML into the right format?
// for demo only, should take from the returned data
var startIndex = Number(this._startIndexParameter);
var rowCount = Number(this._rowCountParameter);
</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
Jim Nickel
Thursday, November 8, 2007
Bump....anyone?
Jim Nickel
Monday, November 12, 2007
Nevermind....the problem is because I hadn't yet taken out the sample response code and the startIndexParameter and the rowCountParameter weren't set. Had nothing to do with my PHP or other code.
I still am unsure of the XML parsing though....
Do I need to parse the XML myself and fill this._data[][] ?
Also....what about sorting? Should I assume that I need to replace the onclick events for the headers with calls to the table.request again with new parameters for sorting?