Comments (14)
What I ended up doing was just triggering a resize event after the table loaded. It's a bit hacky but it works.
from fixed-table-header.
I've found a better way to handle IE11
//checking IE11
var isIE = /*@cc_on!@*/false || !!document.documentMode;
if (isIE) {
clone.css({
boxSizing: 'content-box'
});
}
clone.css({
width: style.width,
minWidth: style.width,
maxWidth: style.width
});
I was reading this earlier https://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug
from fixed-table-header.
Here's the resize event code I use:
window.dispatchEvent(new Event('resize'));
For IE you might have to use this:
var evt = document.createEvent('HTMLEvents');
evt.initEvent('resize', true, false);
window.dispatchEvent(evt);
I also put that in a setTimeout to make sure the table is fully loaded before it triggers. Like I said, it's hacky but it does the job for now.
from fixed-table-header.
if you have child element inside your TH, you need to set the width on the child element instead of setting the width on your TH
this is my code to fix this problem
var setWidth = function () {
marginTop(height());
//checking IE11
var isIE = /@cc_on!@/false || !!document.documentMode;
if (isIE){
clone.children().css({ width: style.width });
} else {
clone.css({ width: style.width });
}
};
from fixed-table-header.
Doesn't work for me.
from fixed-table-header.
try this too
var setWidth = function () {
marginTop(height());
//checking IE11
var isIE = /@cc_on!@/false || !!document.documentMode;
if (isIE) {
var border = parseFloat(style.borderRightWidth, 10) + parseFloat(style.borderLeftWidth, 10);
var padding = parseFloat(style.paddingRight, 10) + parseFloat(style.paddingLeft, 10);
var margin = parseFloat(style.marginLeft, 10) + parseFloat(style.marginRight, 10);
var widthToAdd = parseFloat(style.width, 10) + border + padding + margin;
console.log('width: ', widthToAdd);
clone.css({width: widthToAdd + 'px' });
} else {
clone.css({width: style.width }); //modified to set width directly instead of max and minwidth
}
};
from fixed-table-header.
I have the same problem, only on IE11.
And it's a little odd, because the original thead is properly line up, but not the clone.
from fixed-table-header.
Have you found a solution for this problem yet? I have experienced the same problem using Firefox and IE11.
from fixed-table-header.
What kind of resize event did you trigger?
from fixed-table-header.
Doesn't work for me also.
from fixed-table-header.
@ctqctq It's working, thank you. Please add
clone.css({
width: widthToAdd + 'px',
minWidth: widthToAdd + 'px',
maxWidth: style.width + 'px'
});
from fixed-table-header.
Thanks! You're saving my day.
My working solution looks like this (merged and corrected a bit):
var setWidth = function () {
marginTop(height());
//checking IE11
var isIE = !!document.documentMode;
if (isIE) {
var border = parseFloat(style.borderRightWidth) + parseFloat(style.borderLeftWidth);
var padding = parseFloat(style.paddingRight) + parseFloat(style.paddingLeft);
var margin = parseFloat(style.marginLeft) + parseFloat(style.marginRight);
var widthToAdd = parseFloat(style.width) + border + padding + margin;
console.log('width: ', widthToAdd);
clone.css({
width: widthToAdd + 'px',
minWidth: widthToAdd + 'px',
maxWidth: style.width + 'px'
});
} else {
clone.css({width: style.width }); //modified to set width directly instead of max and minwidth
}
};
from fixed-table-header.
Thanks @ctqctq it works perfectly with IE11. Much better solution.
from fixed-table-header.
Thanks @ctqctq man you saved my life. Cheers.
from fixed-table-header.
Related Issues (20)
- Type error
- Cannot use jQuery resize event to resize on ngShow.
- Doesn't work well with infinite-scroll
- dammage HOT 1
- row headers?
- broken with two <md-content> columns
- disappears when used with ng-repeat HOT 1
- Headings disappear if using ng-if on ancestor element HOT 6
- It deseappear when ised with uib-tabset
- Minimum width for the column HOT 1
- Whole page scrolls when div has height 100%
- Cannot read property '0' of undefined HOT 3
- Error when using some elements inside the fixed header
- Angular 2- 5 support
- overflow: auto causes css rendering issue in chrome
- Cell width and pagination
- Reduce watcher by using ResizeObserver
- RTL Issue
- Not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fixed-table-header.