我正在将此plugin用于我的[[Primefaces项目中的固定表列。它部分起作用。
primefaces v6.1
jQuery v1.7.1
何时工作;
p:dataTable
-> <p:ajax event="page"(and rowSelect) oncomplete"..." />
window.onresize
和窗口加载<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事件。但是
thead
),不适用于正文(tbody
)。我该如何解决?
为了更容易理解,请看两列的gif,首先它可以工作,但是通过按钮更改数据表不起作用,并且我正在调整窗口的大小。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
});
}