Author: abelevich
Date: 2007-04-26 12:03:15 -0400 (Thu, 26 Apr 2007)
New Revision: 573
Modified:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
Log:
Modified:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-04-26
16:02:22 UTC (rev 572)
+++
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-04-26
16:03:15 UTC (rev 573)
@@ -20,7 +20,66 @@
new org.ajax4jsf.framework.resource.PrototypeScript(),
/org/richfaces/renderkit/html/scripts/scrollable-grid.js
</h:scripts>
+
+ <script type="text/javascript">
+ //<![CDATA[
+ var #{this:getJavaScriptVarName(context, component)} = function() {
+ return {
+ init : function() {
+ var currTime = (new Date()).getTime();
+ ClientUILib.log(ClientUILogger.WARNING, "Document loaded over " +
(currTime - ClientUILib.startTime) + " miliseconds.");
+
+ var data = [];
+ for (var index = 0; index < 100; index++) {
+ data[index] = [];
+ for (var index2 = 0; index2 < 6; index2++) {
+ data[index][index2] = index2 + " : " + index;
+ }
+ data[index][6] = index%2 ? "value 1" : "value 2";
+ }
+
+ dataModel = new ClientUI.controls.grid.ArrayDataModel(data);
+
+ var templates = [
+ {pane: GridLayout_Enum.HEADER, ref: "GridHeaderTemplate"},
+ {pane: GridLayout_Enum.BODY, ref: "GridBodyTemplate"},
+ {pane: GridLayout_Enum.FOOTER, ref: "GridFooterTemplate"}
+ ];
+
+ ClientUILib.log(ClientUILogger.WARNING, "DataModel created over " + ((new
Date()).getTime() - currTime) + " miliseconds.");
+ currTime = (new Date()).getTime();
+
+ // create the Grid
+ var grid = new ClientUI.controls.grid.Grid('GridContainer',
dataModel, templates,
+ {
+ showIndexColumn: true,
+ indexColumnWidth: 40
+ }
+ );
+ ClientUILib.log(ClientUILogger.WARNING, "Grid control created over " +
((new Date()).getTime() - currTime) + " miliseconds.");
+
+ grid.updateLayout();
+ Event.observe(grid.eventOnSort, "grid on sort", onSort);
+
+ setTimeout(function() {
+ currTime = (new Date()).getTime();
+ grid.loadData();
+ ClientUILib.log(ClientUILogger.WARNING, "Grid data loaded over " + ((new
Date()).getTime() - currTime) + " miliseconds.");
+ }.bind(this), 100);
+
+ ClientUILib.log(ClientUILogger.WARNING, "Done.");
+ }
+ }
+ }();
+
+ #{this:getScriptContributions(context, component)}
+ Event.observe(window, 'load', #{this:getJavaScriptVarName(context,
component)}.init);
+
+// ]]>
+ </script>
+
+
<div id="GridContainer" style="width:60%; height:300px;"
class="ClientUI_Grid">
<div id="GridHeaderTemplate">
<table class="TestGridHeader" cellpadding="0"
cellspacing="0" border="1">
Show replies by date