Author: sergeyhalipov
Date: 2008-02-26 11:16:08 -0500 (Tue, 26 Feb 2008)
New Revision: 6350
Modified:
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/web.xml
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/scripts/data-table.js
trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataTable.jspx
Log:
Inplace inputs in headers with filter. Correct RETURN key handling added.
Modified: trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/web.xml 2008-02-26
13:50:20 UTC (rev 6349)
+++ trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/web.xml 2008-02-26
16:16:08 UTC (rev 6350)
@@ -13,6 +13,10 @@
<context-param>
<param-name>org.richfaces.demo.MAX_ISSUES</param-name>
<param-value>1000</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
+ <param-value>false</param-value>
</context-param>
<!--
-->
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
---
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-26
13:50:20 UTC (rev 6349)
+++
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-26
16:16:08 UTC (rev 6350)
@@ -553,19 +553,23 @@
protected void addInplaceInput(FacesContext context, UIComponent column, StringBuffer
buffer)
throws IOException {
UIInput filterValueInput = (UIInput)column.getFacet(FILTER_INPUT_FACET_NAME);
- String event = "onviewactivated";
+ boolean inplaceInput = true;
if (null == filterValueInput) {
try {
filterValueInput = (UIInput)
context.getApplication().createComponent("org.richfaces.InplaceInput");
} catch (FacesException e) {
filterValueInput = (UIInput)
context.getApplication().createComponent(UIInput.COMPONENT_TYPE);
- event = "onchange";
+ inplaceInput = false;
}
filterValueInput.setId(column.getId() + SORT_FILTER_PARAMETER);
filterValueInput.setImmediate(true);
column.getFacets().put(FILTER_INPUT_FACET_NAME, filterValueInput);
}
+ String event = inplaceInput ? "onviewactivated" : "onchange";
+ String onkeydownEvent = inplaceInput ? "oninputkeydown" :
"onkeydown";
+
filterValueInput.getAttributes().put(event, buffer.toString());
+ filterValueInput.getAttributes().put(onkeydownEvent,
"RichFaces.blurFilterInput(event);");
filterValueInput.setValue(column.getAttributes().get("filterValue"));
getUtils().encodeBeginFormIfNessesary(context, column);
Modified:
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/scripts/data-table.js
===================================================================
---
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/scripts/data-table.js 2008-02-26
13:50:20 UTC (rev 6349)
+++
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/scripts/data-table.js 2008-02-26
16:16:08 UTC (rev 6350)
@@ -292,3 +292,9 @@
}
});
+RichFaces.blurFilterInput = function(event) {
+ if (event.keyCode == Event.KEY_RETURN && Event.element(event)) {
+ Event.element(event).blur();
+ return false;
+ }
+};
Modified: trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataTable.jspx
===================================================================
--- trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataTable.jspx 2008-02-26
13:50:20 UTC (rev 6349)
+++ trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataTable.jspx 2008-02-26
16:16:08 UTC (rev 6350)
@@ -16,7 +16,8 @@
<h:scripts>
new org.ajax4jsf.javascript.AjaxScript(),
new org.ajax4jsf.javascript.PrototypeScript(),
- /org/richfaces/renderkit/html/scripts/inplaceinput.js
+ /org/richfaces/renderkit/html/scripts/inplaceinput.js,
+ /org/richfaces/renderkit/html/scripts/data-table.js
</h:scripts>
<f:clientid var="clientId"/>
<table id="#{clientId}"