Permalink
Browse files

fix: pro-IUAPDESIGN-50:友云采:grid表格数据不显示省略号(增加各行显示)

  • Loading branch information...
1 parent c33833b commit b6a46ac78b14fbb5eff95f547666f6a650323bba liuyk committed Oct 25, 2016
Showing with 44 additions and 2 deletions.
  1. +10 −0 css/grid.css
  2. +3 −1 js/gridComp.js
  3. +30 −1 js/gridCompRenderType.js
  4. +1 −0 js/re_gridCompEdit.js
View
@@ -272,6 +272,7 @@ content区域css begin
height: 2.68em \9;
line-height: 2.68em \9;
font-size: 16px !important;
+ overflow: hidden;
}
.u-grid tbody tr:last-child td{
@@ -304,6 +305,15 @@ content区域css begin
text-overflow: ellipsis;
height: 100%;
}
+.u-grid-content-td-div-over::after{
+ content:"...";
+ font-weight:bold;
+ position:absolute;
+ bottom:15px;
+ right: -5px;
+}
+
+
.u-grid-content-td-div > input{
height:100%;
}
View
@@ -114,7 +114,8 @@ import {
import {
renderTypeFun,
renderTypeByColumn,
- renderTypeSumRow
+ renderTypeSumRow,
+ getRenderOverFlag
} from './gridCompRenderType';
import {
@@ -328,6 +329,7 @@ gridComp.prototype.resetNumCol = resetNumCol;
gridComp.prototype.renderTypeFun = renderTypeFun;
gridComp.prototype.renderTypeByColumn = renderTypeByColumn;
gridComp.prototype.renderTypeSumRow = renderTypeSumRow;
+gridComp.prototype.getRenderOverFlag = getRenderOverFlag;
gridComp.prototype.setColumnVisibleByColumn = setColumnVisibleByColumn;
@@ -164,17 +164,46 @@ const renderTypeByColumn = function(gridCompColumn,i,begin,length, isFixedColumn
}
span.innerHTML = v;
}
+
+ /* 增加处理判断是否需要显示... */
+ var obj = {
+ span: span,
+ column: gridCompColumn
+ };
+ var overFlag = oThis.getRenderOverFlag(obj);
+ if (overFlag) {
+ $(span).addClass('u-grid-content-td-div-over');
+ }
}
}
}
});
this.renderTypeSumRow(gridCompColumn,i,begin,length, isFixedColumn);
};
+
+const getRenderOverFlag = function(obj){
+ var span = obj.span;
+ var nowHeight = span.offsetHeight;
+ var nowWidth = span.offsetWidth;
+ var newSpan = $(span).clone()[0];
+ var overFlag = false;
+ obj.span.parentNode.appendChild(newSpan);
+ newSpan.style.height = '';
+ newSpan.style.maxHeight = '999999px';
+ var newHeight = newSpan.offsetHeight;
+ if (newHeight > nowHeight) {
+ overFlag = true;
+ }
+ obj.span.parentNode.removeChild(newSpan);
+ return overFlag;
+};
+
const renderTypeSumRow = function(gridCompColumn,i,begin,length, isFixedColumn){
};
export{
renderTypeFun,
renderTypeByColumn,
- renderTypeSumRow
+ renderTypeSumRow,
+ getRenderOverFlag
}
@@ -11,6 +11,7 @@ const re_clickFunEdit = function(e,index){
var $td = $(e.target).closest('td');
var colIndex = $td.index();
if(this.options.editable && (this.eidtRowIndex != index || (this.options.editType == 'default' && this.editColIndex != colIndex))){
+ this.editClose();
if(typeof this.options.onBeforeEditFun == 'function'){
var obj = {};
obj.gridObj = this;

0 comments on commit b6a46ac

Please sign in to comment.