【发布时间】:2016-10-02 08:46:22
【问题描述】:
有一个 emberjs 插件,它是一个包含隐藏列的表。
在该表上,我通过 css-position 和 top 修复了表头(和左列)。
// Set table head fixed
function fixHead () {
console.log('tableFixer: fixHead()');
var thead = Ember.$(settings.table).find("thead");
var cells = thead.find("tr > *");
cells.css({
'position' : 'relative',
'background' : '#ff0000',
});
console.log(cells); // in here I see ALL the cells, also the hidden ones
}
我用 ember 操作显示隐藏的列。
expandChildColumn: function(column, sourceIndex) {
this.get('columns')[sourceIndex+1].set('visible',true);
},
一切都很好,直到显示“子”列,主要显示的列的第 th 列是固定的。
但我的问题是,jquery 的 css 方法似乎不适用于隐藏元素。
所以新显示的列不固定。
既不应用位置也不应用背景。
我在文档中没有找到任何关于此的内容。
是否有任何特殊的参数可以让 css 应用于隐藏元素?
基于这个问题,我即将想到,我必须先显示该列,设置 css 并再次隐藏它:jQuery: Get height of hidden element in jQuery
【问题讨论】:
标签: javascript jquery ember.js