Author: abelevich
Date: 2007-05-10 14:22:06 -0400 (Thu, 10 May 2007)
New Revision: 722
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-10
14:07:47 UTC (rev 721)
+++
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-05-10
18:22:06 UTC (rev 722)
@@ -20,15 +20,43 @@
<h:scripts>
new org.ajax4jsf.framework.resource.PrototypeScript(),
+ new org.ajax4jsf.framework.ajax.AjaxScript(),
/org/richfaces/renderkit/html/scripts/scrollable-grid.js
</h:scripts>
+ <f:clientId var="clientId" />
+
+
+ <div id="#{clientId}_GridContainer" style="width: 90%;
height:500px;" class="ClientUI_Grid">
+ <div id="#{clientId}_GridHeaderTemplate">
+ <table class="TestGridHeader" cellpadding="0"
cellspacing="0" border="1">
+ <tbody>
+ <f:call name="renderHeaders"/>
+ </tbody>
+ </table>
+ </div>
+ <div id="#{clientId}_GridBodyTemplate">
+ <vcp:body/>
+ </div>
+ <f:clientId var="clientId" />
+ <div id="#{clientId}_GridFooterTemplate">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <f:call name="renderFooters"/>
+ </tbody>
+ </table>
+ </div>
+ <input type="hidden" name="#{clientId}_state_input"
id="#{clientId}_state_input"/>
+ <input type="button" name="#{clientId}_submit_input"
id="#{clientId}_submit_input"
onclick="#{this:getRowsAjaxUpdate(context,component)}"
style="display:none"/>
+
+ </div>
- <script type="text/javascript">
+ <f:call name="tearDownState"/>
+
+
+ <script id="#{clientId}_model_create_scripts"
type="text/javascript">
//<![CDATA[
-
-
ClientUI.controls.grid.FakeArrayDataModel = Class.create({
CLASSDEF: {
name: 'ClientUI.controls.grid.FakeArrayDataModel',
@@ -37,16 +65,17 @@
});
Object.extend(ClientUI.controls.grid.FakeArrayDataModel.prototype, {
- initialize: function(rows_count, columns_count) {
+ initialize: function(rows_count, columns_count, grid_id) {
ClientUI.controls.grid.FakeArrayDataModel.parentClass.constructor().call(this);
this.data = [];
this.count = rows_count;
this.columns = columns_count;
+ this.gridId = grid_id;
},
getRow: function(index) {
if(!this.data[index]) {
this.data[index] = [];
- for (var index2 = 0; index2 < 18; index2++) {
+ for (var index2 = 0; index2 < 7; index2++) {
this.data[index][index2] = index2 + " : " + index;
}
this.data[index][6] = index%2 ? "value 1" : "value 2";
@@ -59,12 +88,21 @@
},
getRequestDelay: function() {
return 50;
+ },
+
+ loadRows: function(options) {
+ var state_options = options;
+ var state_input = $(this.gridId + "_state_input");
+ var submit_input = $(this.gridId + "_submit_input");
+ var submit_values = state_options.count + "," + state_options.index +
"," + state_options.startRow;
+ state_input.value = submit_values;
+ submit_input.click();
}
});
// ]]>
</script>
- <script type="text/javascript">
+ <script id="#{clientId}_grid_create_scripts"
type="text/javascript">
//<![CDATA[
@@ -73,20 +111,23 @@
init : function() {
var currTime = (new Date()).getTime();
// ClientUILib.log(ClientUILogger.WARNING, "Document loaded over " +
(currTime - ClientUILib.startTime) + " miliseconds.");
-
- dataModel = new ClientUI.controls.grid.FakeArrayDataModel(1000, 18);
+ var clientId = '#{clientId}';
+ var rows_count = '#{rows_count}';
+ // var column_count = '#{row_column}';
+
+ dataModel = new ClientUI.controls.grid.FakeArrayDataModel(1000, 8, clientId);
var templates = [
- {pane: GridLayout_Enum.HEADER, ref: "GridHeaderTemplate"},
- {pane: GridLayout_Enum.BODY, ref: "GridBodyTemplate"},
- {pane: GridLayout_Enum.FOOTER, ref: "GridFooterTemplate"}
+ {pane: GridLayout_Enum.HEADER, ref: clientId +"_" +
"GridHeaderTemplate"},
+ {pane: GridLayout_Enum.BODY, ref: clientId +"_" +
"GridBodyTemplate"},
+ {pane: GridLayout_Enum.FOOTER, ref: clientId +"_" +
"GridFooterTemplate"}
];
// ClientUILib.log(ClientUILogger.WARNING, "DataModel created over " +
((new Date()).getTime() - currTime) + " miliseconds.");
// currTime = (new Date()).getTime();
// create the Grid
- grid = new ClientUI.controls.grid.Grid2('GridContainer', dataModel,
templates,
+ grid = new ClientUI.controls.grid.Grid2(clientId +"_" +
'GridContainer', dataModel, templates,
{
showIndexColumn: false,
indexColumnWidth: 40
@@ -112,31 +153,6 @@
// ]]>
</script>
-
-
- <div id="GridContainer" style="width: 90%; height:500px;"
class="ClientUI_Grid">
- <div id="GridHeaderTemplate">
- <table class="TestGridHeader" cellpadding="0"
cellspacing="0" border="1">
- <tbody>
- <f:call name="renderHeaders"/>
- </tbody>
- </table>
- </div>
- <div id="GridBodyTemplate">
- <vcp:body/>
- </div>
- <div id="GridFooterTemplate">
- <table cellpadding="0" cellspacing="0">
- <tbody>
- <f:call name="renderFooters"/>
- </tbody>
- </table>
- </div>
- </div>
- <f:clientId var="clientId" />
- <c:set var="inputType" value="hidden"/>
- <input type="#{inputType}" name="#{clientId}_range"
id="#{clientId}_range"/>
- <f:call name="tearDownState"/>
</f:root>