Author: abelevich
Date: 2008-06-09 07:34:48 -0400 (Mon, 09 Jun 2008)
New Revision: 8953
Modified:
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
trunk/ui/pickList/src/main/templates/htmlPickList.jspx
Log:
http://jira.jboss.com/jira/browse/RF-3609
Modified: trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
---
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-06-09
11:20:56 UTC (rev 8952)
+++
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-06-09
11:34:48 UTC (rev 8953)
@@ -10,6 +10,7 @@
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import java.util.Set;
import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
@@ -23,6 +24,7 @@
import javax.faces.model.SelectItem;
import javax.faces.model.SelectItemGroup;
+import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.javascript.ScriptString;
@@ -480,4 +482,13 @@
}
writer.endElement(HTML.DIV_ELEM);
}
+
+ public void reRenderScript(FacesContext context, UIComponent component) throws
IOException {
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ Set <String> areas = ajaxContext.getAjaxRenderedAreas();
+ String clientId = component.getClientId(context);
+ if (ajaxContext.isAjaxRequest() && areas.contains(clientId)){
+ areas.add(clientId + "script");
+ }
+ }
}
Modified: trunk/ui/pickList/src/main/templates/htmlPickList.jspx
===================================================================
--- trunk/ui/pickList/src/main/templates/htmlPickList.jspx 2008-06-09 11:20:56 UTC (rev
8952)
+++ trunk/ui/pickList/src/main/templates/htmlPickList.jspx 2008-06-09 11:34:48 UTC (rev
8953)
@@ -152,19 +152,24 @@
</tbody>
</table>
<f:clientId var="clientId"/>
- <script type="text/javascript">
-
- var clientId = '#{clientId}';
- RichShuttleUtils.execOnLoad(
- function(){
- new Richfaces.PickList(
- new Richfaces.PickList.Target('#{clientId}',
'#{clientId}tlInternal_tab', '#{clientId}tlInternal_header_tab',
'#{clientId}tlFocusKeeper', undefined, Richfaces.PickList.Target.SelectItem,
#{this:getColumnClassesAsJSArray(context, component)},
#{this:getRowClassesAsJSArray(context, component)}),
- new Richfaces.PickList.Source('#{clientId}',
'#{clientId}internal_tab', '#{clientId}internal_header_tab',
'#{clientId}focusKeeper', undefined, Richfaces.PickList.Source.SelectItem,
#{this:getColumnClassesAsJSArray(context, component)},
#{this:getRowClassesAsJSArray(context, component)}),
- "#{clientId}", [['copy', 'discopy'], ['copyAll',
'discopyAll'], ['remove', 'disremove'],
['removeAll','disremoveAll']],
- "#{switchByClick}", {onlistchanged: #{this:getAsEventHandler(context,
component, "onlistchanged")}},
- "#{clientId}valueKeeper");
- },
- RichShuttleUtils.Condition.ElementPresent("#{clientId}"), 100
- );
- </script>
+
+ <span id="#{clientId}script">
+ <f:call name="reRenderScript" />
+
+ <script type="text/javascript">
+
+ var clientId = '#{clientId}';
+ RichShuttleUtils.execOnLoad(
+ function(){
+ new Richfaces.PickList(
+ new Richfaces.PickList.Target('#{clientId}',
'#{clientId}tlInternal_tab', '#{clientId}tlInternal_header_tab',
'#{clientId}tlFocusKeeper', undefined, Richfaces.PickList.Target.SelectItem,
#{this:getColumnClassesAsJSArray(context, component)},
#{this:getRowClassesAsJSArray(context, component)}),
+ new Richfaces.PickList.Source('#{clientId}',
'#{clientId}internal_tab', '#{clientId}internal_header_tab',
'#{clientId}focusKeeper', undefined, Richfaces.PickList.Source.SelectItem,
#{this:getColumnClassesAsJSArray(context, component)},
#{this:getRowClassesAsJSArray(context, component)}),
+ "#{clientId}", [['copy', 'discopy'], ['copyAll',
'discopyAll'], ['remove', 'disremove'],
['removeAll','disremoveAll']],
+ "#{switchByClick}", {onlistchanged: #{this:getAsEventHandler(context,
component, "onlistchanged")}},
+ "#{clientId}valueKeeper");
+ },
+ RichShuttleUtils.Condition.ElementPresent("#{clientId}"), 100
+ );
+ </script>
+ </span>
</f:root>
\ No newline at end of file