修改日志列宽度,详情宽度

This commit is contained in:
zhanghongqing
2018-08-27 21:16:47 +08:00
parent 18bfc299e4
commit 2fac813097
2 changed files with 18 additions and 39 deletions

View File

@@ -10,7 +10,7 @@ $(document).ready(function() {
this.title=str;
});
var fontSize = 0;
$("table.logTb th").each(function(){
$("table.logTb th").each(function(j){
// 判断是否支持currentStyle属性 是IE 否FF or Chrome
var finalStyle = this.currentStyle ? this.currentStyle : document.defaultView.getComputedStyle(this , null);
fontSize = (finalStyle.fontSize).replace("px","");
@@ -20,11 +20,15 @@ $(document).ready(function() {
// URL列加宽
var th = this;
var thText = this.innerText;
$("table.logTb td").each(function(){
var tdText = this.innerText;
if((tdText.trim().length > thText.trim().length) && (thText == "URL" || thText == "Log URI")){
th.setAttribute('width','110px');
}
//将字符串过宽的列增加宽度
$("table.logTb tbody tr").each(function(){
$(this).find("td").each(function(i){
var tdText = this.innerText;
if((tdText.trim().length > thText.trim().length) && j==i && tdText.trim().length>7){
var px = getPixelsCount(thText,fontSize)+100;
th.setAttribute('width',px+'px');
}
});
});
});