I'm having some problems with richfaces combobox/suggestionbox. Everything works fine when they're rendered along with the page, but as soon as I rerender the they're contained in, they're not rendered and I get a JS-exception saying:
Uncaught Error: NOT_SUPPORTED_ERR: DOM Exception 9
(it looks like something in A4J.AJAX.XMLHttpRequest.updatePagePart is failing..)
Relevant part of code:
<a:outputPanel id="autoFillPanel">
<a:outputPanel layout="none" rendered="#{myBean.renderAutofiller}">
<h:inputText id="autofillInput" value="#{myBean.value}" />
<rich:suggestionbox for="autofillInput" var="result"
suggestionAction="#{myBean.autoCompleteFiller}">
开发者_运维问答 <h:column>
<h:outputText value="#{result}" />
</h:column>
</rich:suggestionbox>
</a:outputPanel>
</a:outputPanel>
Any ideas? I haven't had this problem with any other components (h:inputTexts etc..)
It seems to be a problem with webkit implementation of document.importNode. To circumvent this problem you can use this little piece of javascript code on your template file:
if( /webkit/.test( navigator.userAgent.toLowerCase() ) ){
var _importNode = window.document.importNode;
window.document.importNode = function(node, deep){
try{
return _importNode.apply(this, arguments);
} catch(e) {
if( e.code == DOMException.NOT_SUPPORTED_ERR ){
// clone and adopt
return document.adoptNode(node.cloneNode(deep));
}
throw e;
}
};
}
Even when this question is old , i ran into the same problem and solved it in our application.
We have the same setup: Richfaces 3.3.3, IE9, modified Ajax.js to allow IE9 run in native mode instead of emulating IE7.
in suggestionbox.js, there is a workaround for IE to keep the focus: (line 126++)
//IE only
if (RichFaces.navigatorType() == RichFaces.MSIE) {
Event.observe(this.element, "focusout", function(event) {
//in IE8+ , event.toElement is no longer supported for focusout
var elt = event.toElement || event.relatedTarget; //CHANGE HERE
while (elt) {
if (elt == this.update) {
this.element.keepFocus = true;
elt = undefined;
} else {
elt = elt.parentNode;
}
}
}.bindAsEventListener(this));
}
With the change i marked, the code runs fine in IE9 for me, and scrolling with the scrollbar is possible again.
精彩评论