Author: abelevich
Date: 2007-05-07 14:34:55 -0400 (Mon, 07 May 2007)
New Revision: 679
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-05-07
18:34:32 UTC (rev 678)
+++
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-05-07
18:34:55 UTC (rev 679)
@@ -24,52 +24,82 @@
<script type="text/javascript">
//<![CDATA[
+
+ ClientUI.controls.grid.FakeArrayDataModel = Class.create({
+ CLASSDEF: {
+ name: 'ClientUI.controls.grid.FakeArrayDataModel',
+ parent: ClientUI.controls.grid.DataModel
+ }
+ });
+
+ Object.extend(ClientUI.controls.grid.FakeArrayDataModel.prototype, {
+ initialize: function(rows_count, columns_count) {
+ ClientUI.controls.grid.FakeArrayDataModel.parentClass.constructor().call(this);
+ this.data = [];
+ this.count = rows_count;
+ this.columns = columns_count;
+ },
+ getRow: function(index) {
+ if(!this.data[index]) {
+ this.data[index] = [];
+ for (var index2 = 0; index2 < 18; index2++) {
+ this.data[index][index2] = index2 + " : " + index;
+ }
+ this.data[index][6] = index%2 ? "value 1" : "value 2";
+ }
+
+ return this.data[index];
+ },
+ getCount: function() {
+ return this.count;
+ },
+ getRequestDelay: function() {
+ return 50;
+ }
+ });
+ // ]]>
+ </script>
+
+ <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);
-
+ // ClientUILib.log(ClientUILogger.WARNING, "Document loaded over " +
(currTime - ClientUILib.startTime) + " miliseconds.");
+
+ dataModel = new ClientUI.controls.grid.FakeArrayDataModel(1000, 18);
+
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();
-
+
+ // 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,
+ grid = new ClientUI.controls.grid.Grid2('GridContainer', dataModel,
templates,
{
- showIndexColumn: true,
+ showIndexColumn: false,
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.");
- }
+ // ClientUILib.log(ClientUILogger.WARNING, "Grid control created over " +
((new Date()).getTime() - currTime) + " miliseconds.");
+
+ grid.updateLayout();
+
+ setTimeout(function() {
+ currTime = (new Date()).getTime();
+ //grid.loadData();
+ }.bind(this), 100);
+
+ // ClientUILib.log(ClientUILogger.WARNING, "Done.");
+ }
+
}
}();
@@ -80,20 +110,22 @@
</script>
- <div id="GridContainer" style="width:60%; height:300px;"
class="ClientUI_Grid">
+ <div id="GridContainer" style="width: 90%; height:500px;"
class="ClientUI_Grid">
<div id="GridHeaderTemplate">
<table class="TestGridHeader" cellpadding="0"
cellspacing="0" border="1">
- <f:call name="renderHeaders"/>
+ <tbody>
+ <f:call name="renderHeaders"/>
+ </tbody>
</table>
</div>
<div id="GridBodyTemplate">
- <table cellpadding="0" cellspacing="0">
- <vcp:body/>
- </table>
+ <vcp:body/>
</div>
<div id="GridFooterTemplate">
<table cellpadding="0" cellspacing="0">
- <f:call name="renderFooters"/>
+ <tbody>
+ <f:call name="renderFooters"/>
+ </tbody>
</table>
</div>
</div>
Show replies by date