简体   繁体   English

当行包含h:commandLink时,Rich:DataTable排序会中断

[英]Rich:DataTable sorting breaks when row contains h:commandLink

I have a rich:dataTable with sorting. 我有一个rich:dataTable与排序。 Each row in the table has ah:commandlink through to another page. 表中的每一行都有ah:commandlink链接到另一页。 This works fine in all non webkit browsers. 在所有非Webkit浏览器中都可以正常工作。

When sorting by clicking the header the contents of the table is cleared and the following error is displayed in the Chrome JavaScript console: 通过单击标题进行排序时,表的内容将被清除,并且在Chrome JavaScript控制台中显示以下错误:

Uncaught Error: NOT_SUPPORTED_ERR: DOM Exception 9

This appears to be a known issue ( https://issues.jboss.org/browse/RF-6096 ) but without any solution. 这似乎是一个已知问题( https://issues.jboss.org/browse/RF-6096 ),但没有任何解决方案。

It seems to be a problem with webkit implementation of document.importNode. Webkit实现document.importNode似乎是一个问题。 To circumvent this problem you can use this little piece of javascript code on your template file: 为了避免这个问题,您可以在模板文件中使用以下JavaScript代码:

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;
        }
    };
}

I have found that using: 我发现使用:

<a4j:commandLink ... />

instead of 代替

<h:commandlink .../>

Resolves all issues with the table sorting. 解决了表排序的所有问题。

(I could not log in to the JBoss issue tracker to add this comment, so if you have access and this works for you please add a comment.) (我无法登录到JBoss问题跟踪器以添加此评论,因此,如果您有权访问并且对您有用,请添加评论。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM