Author: abelevich
Date: 2007-06-25 12:27:16 -0400 (Mon, 25 Jun 2007)
New Revision: 1299
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
Log:
fix create of scrolling event
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-25
16:25:32 UTC (rev 1298)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-25
16:27:16 UTC (rev 1299)
@@ -1,8 +1,10 @@
package org.richfaces.renderkit.html;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import javax.faces.component.UIComponent;
@@ -123,8 +125,6 @@
renderChild(context, component);
}
headerCellTemplate.encodeEnd(context, column);
-
-
}
};
@@ -187,7 +187,7 @@
UIScrollableGrid grid = state.getGrid();
grid.setRowKey(rowKey);
-
+
if(grid.isRowAvailable() || state.isFake()){
String row_id;
@@ -244,6 +244,7 @@
UIScrollableGrid grid = state.getGrid();
Collection collection = grid.getResponseData();
+
grid.setRowKey(rowKey);
ResponseWriter writer = context.getResponseWriter();
state.setFrozenColumnCount(GridUtils.getFrozenColumnsCount(grid));
@@ -375,12 +376,15 @@
state.setFrozenColumnCount(GridUtils.getFrozenColumnsCount(grid));
state.setFrozenPart(isFrozen);
state.setClientId(grid.getClientId(context));
+
grid.walk(context, rowsRenderer, state);
+
int fakeRowsCount = grid.getRows() - grid.getRowCount();
state.setFake(true);
for (int i = 0; i < fakeRowsCount; i++) {
rowsRenderer.process(context, null, state);
}
+
state.setFake(false);
grid.setRowKey(null);
}
@@ -459,6 +463,8 @@
JSFunction function = AjaxRendererUtils.buildAjaxFunction(grid, context);
Map options = AjaxRendererUtils.buildEventOptions(context, grid);
options.put("oncomplete", AjaxFunctionBuilder.getOnComplete(context, grid,
this, AjaxFunctionBuilder.SCROLL));
+ Map parametersMap = (Map)options.get("parameters");
+ parametersMap.put(grid.getBaseClientId(context) + ":scroll", "");
function.addParameter(options);
String completeFunction = function.toScript()+"; return false;";
@@ -547,9 +553,10 @@
}
}
- if(parameters.containsKey(clientId + "_state_input") && !sorted){
+
+ if(parameters.containsKey(clientId + ":scroll") && !sorted){
+
String submitedState = (String)parameters.get(clientId + "_state_input");
-
boolean isEmpty = true;
@@ -565,18 +572,13 @@
grid.getAttributes().put(GridUtils.CLIENT_ROW_KEY,Integer.valueOf(values[2]));
rows = Integer.parseInt(values[0]);
first = Integer.parseInt(values[1]);
-
- }else{
- grid.getAttributes().put(GridUtils.CLIENT_ROW_KEY, new Integer(0));
- rows = grid.getRows();
- }
-
- ScrollEvent scrollEvent = new ScrollEvent(grid,rows,first);
- grid.queueEvent(scrollEvent);
+ ScrollEvent scrollEvent = new ScrollEvent(grid,rows,first);
+ grid.queueEvent(scrollEvent);
- if (ajaxContext.isAjaxRequest()) {
- component.getAttributes().put(PARTIAL_UPDATE, Boolean.TRUE);
- }
+ if (ajaxContext.isAjaxRequest()) {
+ component.getAttributes().put(PARTIAL_UPDATE, Boolean.TRUE);
+ }
+ }
}
}
Show replies by date