Primefaces数据表冻结列行高不匹配
Primefaces数据表冻结列存在行高不匹配问题。冻结列和未冻结列的行高不匹配,就像独立的数据表一样。行高度在左侧和右侧布局中独立调整Primefaces数据表冻结列行高不匹配,primefaces,datatable,frozen-columns,Primefaces,Datatable,Frozen Columns,Primefaces数据表冻结列存在行高不匹配问题。冻结列和未冻结列的行高不匹配,就像独立的数据表一样。行高度在左侧和右侧布局中独立调整 对于PrimeFaces 5.3版,我编写了用于同步行高度的解决方案,这是一个在dom就绪时调用的小javascript函数: <h:outputScript target="body"> $(function() { synchronizeRowsHeight(); }); function synchr
对于PrimeFaces 5.3版,我编写了用于同步行高度的解决方案,这是一个在dom就绪时调用的小javascript函数:
<h:outputScript target="body">
$(function() {
synchronizeRowsHeight();
});
function synchronizeRowsHeight() {
var $leftRows = $('.ui-datatable-frozenlayout-left').find('tr');
var $rightRows = $('.ui-datatable-frozenlayout-right').find('tr');
$leftRows.each(function (index) {
var $leftRow = $(this);
var $rightRow = $rightRows.eq(index);
if ($rightRow.innerHeight() > $leftRow.innerHeight()) {
$leftRow.innerHeight($rightRow.outerHeight());
} else {
$rightRow.innerHeight($leftRow.outerHeight());
}
})
}
</h:outputScript>
$(函数(){
synchronizeRowsHeight();
});
函数synchronizeRowsHeight(){
var$leftRows=$('.ui datatable frozenlayout left')。find('tr');
var$rightRows=$('.ui datatable frozenlayout right')。find('tr');
$leftRows.each(函数(索引){
变量$leftRow=$(此);
var$rightRow=$rightRows.eq(索引);
如果($rightRow.innerHeight()>$leftRow.innerHeight()){
$leftRow.innerHeight($rightRow.outerHeight());
}否则{
$rightRow.innerHeight($leftRow.outerHeight());
}
})
}
PF版本?如果较新版本表现出相同的行为,则有两种解决方法:确保普通单元格具有默认高度,或者编写一些javascript和css,将普通行的高度复制到固定列的行中。在firefox中可以正常工作,但chrome仍会造成一些不匹配。如果分页呢?过滤器?排序?我只有静态表。。。但在排序/过滤后调用此函数是可能的。Gi发现如何使chrome和firefox设置正确的宽度,需要替换$rightRow.innerHeight($leftRow.innerHeight())代码>到$rightRow.innerHeight($leftRow.outerHeight())代码>,以及$leftRow.innerHeight($rightRow.innerHeight())代码>到$leftRow.innerHeight($rightRow.outerHeight())代码>。我仍然无法解释这一点,但它起作用了。它在IE9上不起作用