当ajax完成时,jquery无法正常工作,Primefaces

问题描述 投票:-1回答:1

我正在将此plugin用于我的[[Primefaces项目中的固定表列。它部分起作用。

primefaces v6.1 jQuery v1.7.1
何时工作;

    p:dataTable-> <p:ajax event="page"(and rowSelect) oncomplete"..." />
  • window.onresize和窗口加载
  • 刷新页面(F5)
  • 何时不起作用;

      [<p:commandButton oncoplete="..." />此按钮ubdate表格。
  • 我在下面分享了该项目的详细信息。

    Outline xhtml;

    + <p:tab> +- <h:form id="myForm" > +-- <p:panelGrid> +--- <div> +---- <p:commandButton update=":myForm" oncomplete="load()"> +-- <p:dataTable> ...

    概述脚本;

    $(document).ready(function(){ load(); }); function load(){ $("div.ui-datatable-tablewrapper").find('table').tableHeadFixer({ left: 2 }); }

    正如我所说,它适用于dataTable ajax事件。

    但是

  • 单击commandButton时,仅适用于标题(thead),不适用于正文(tbody)。

    我该如何解决?

    为了更容易理解,请看两列的gif,首先它可以工作,但是通过按钮更改数据表不起作用,并且我正在调整窗口的大小。enter image description here
    javascript jquery ajax jsf primefaces
    1个回答
    -1
    投票
    我已修复

    primefaces实际问题。当commandButton完成ajax请求时,运行任何js函数,此函数将调用p:remoteCommand

    <p:commandButton oncomplete="reload()" /> <p:remoteCommand name="remote" oncomplete="load()" />
    $(document).ready(function(){
        load(); 
    });
    function reload(){
        remote();
    }
    function load(){
        $("div.ui-datatable-tablewrapper").find('table').tableHeadFixer({
            left: 2
        });     
    }
    
    © www.soinside.com 2019 - 2024. All rights reserved.