日志界面对cfgId列不进行过长截取.

This commit is contained in:
zhangwenqing
2018-08-08 21:14:09 +08:00
parent b29a83660f
commit adfb3b7182
2 changed files with 24 additions and 7 deletions

View File

@@ -3,7 +3,7 @@ table.logTb {
table-layout: fixed;
}
table.logTb td {
table.logTb td ~td {
width: 100px;
overflow: hidden;
white-space: nowrap;

View File

@@ -3,21 +3,38 @@ $(document).ready(function() {
$("table.logTb").find("td").not(":has(a)").bind("mouseover", function(){
this.title=$(this).html(this.innerHTML.trim()).text();
});
var fontSize = 0;
$("table.logTb th").each(function(){
// 判断是否支持currentStyle属性 是IE 否FF or Chrome
var finalStyle = this.currentStyle ? this.currentStyle : document.defaultView.getComputedStyle(this , null);
var fontSize = (finalStyle.fontSize).replace("px","");
fontSize = (finalStyle.fontSize).replace("px","");
// 设置界面标题宽度(不包括第一列)
var px = getPixelsCount($(this).text(),fontSize)+32;
this.setAttribute('width',px+'px');
});
})
var tdString = "";
$("table.logTb tbody tr").each(function(){
tdString = $(this).find('td:first').text();
});
$("table.logTb th:lt(1)").each(function(){
// 设置界面第一列标题宽度
var thString = $(this).text();
if(tdString.trim().length < thString.length){
var thPx = getPixelsCount(thString,fontSize)+32;
this.setAttribute('width',thPx+'px');
}else{
var tdPx = getPixelsCount(tdString,fontSize)+45;
this.setAttribute('width',tdPx+'px');
}
});
});
// 获取界面标题字符串对等的像素值
// 获取字符串对等的像素值
function getPixelsCount(str, strFontSize){
// 字符串字符个数
// 字符个数
var stringCharsCount = str.length;
// 像素值