Author: abelevich
Date: 2007-07-05 13:43:52 -0400 (Thu, 05 Jul 2007)
New Revision: 1492
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
Log:
add hidden input rendering method for storing scroll position values
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
---
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-07-05
17:42:29 UTC (rev 1491)
+++
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-07-05
17:43:52 UTC (rev 1492)
@@ -1,10 +1,8 @@
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;
@@ -22,6 +20,7 @@
import org.ajax4jsf.framework.util.javascript.JSFunction;
import org.ajax4jsf.framework.util.javascript.JSFunctionDefinition;
import org.ajax4jsf.framework.util.javascript.JSReference;
+import org.ajax4jsf.framework.util.javascript.ScriptUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.richfaces.component.UIScrollableGrid;
@@ -551,6 +550,13 @@
boolean sorted = false;
Map parameters = externalContext.getRequestParameterMap();
+ String s_id = clientId + ":si";
+ if(parameters.containsKey(s_id)){
+ String options = (String)parameters.get(s_id);
+ grid.setScrollPos(options);
+ }
+
+
if(parameters.containsKey(clientId + ":sortColumn") &&
parameters.containsKey(clientId + ":sortStartRow") &&
parameters.containsKey(clientId + ":sortIndex") &&
@@ -618,6 +624,8 @@
}
}
}
+
+
}
@@ -654,6 +662,7 @@
grid.setRowKey(null);
ajaxContext.setResponseData(grid.getResponseData());
+
ajaxContext.getAjaxRenderedAreas().remove(grid.getClientId(context));
GridScrollSettings options = createOptions(grid);
ajaxContext.getResponseDataMap().put("options", options);
@@ -746,6 +755,21 @@
return footerCellTemplate;
}
+ public void renderHiddenScrollInput(FacesContext context, UIScrollableGrid grid) throws
IOException{
+
+ ResponseWriter writer = context.getResponseWriter();
+ String id = grid.getClientId(context) + ":si";
+ writer.startElement("input", grid);
+
+ getUtils().writeAttribute(writer, "type", "hidden");
+ getUtils().writeAttribute(writer, "name", id);
+ getUtils().writeAttribute(writer, "id", id);
+ getUtils().writeAttribute(writer, "value", grid.getScrollPos());
+
+ writer.endElement("input");
+
+ }
+
public void contributorsEncodeHere(FacesContext context, UIScrollableGrid grid) throws
IOException {
RendererContributor [] contribs = getContributors();
Show replies by date