Permalink
Browse files

fix: 兼容ie修改hide这些方法

  • Loading branch information...
whizbz11 committed Jan 18, 2017
1 parent 7bd49d1 commit 8202e903ad1212360029fbc569141a1c23826354
Showing with 86 additions and 39 deletions.
  1. +46 −22 dist/js/u-grid.js
  2. +3 −3 dist/js/u-grid.min.js
  3. +37 −14 js/re_gridCompEdit.js
View
@@ -733,20 +733,20 @@
var row = oThis.dataSourceObj.rows[index];
if (row) {
var rowChildIndex = oThis.getChildRowIndex(row);
- if ($target.hasClass('uf-minusbutton') || $target.hasClass('uf-addsquarebutton2')) {
- var minus = $td.find('.uf-minusbutton');
- var plus = $td.find('.uf-addsquarebutton2');
+ if ($target.hasClass('uf-reduce-s-o') || $target.hasClass('uf-add-s-o')) {
+ var minus = $td.find('.uf-reduce-s-o');
+ var plus = $td.find('.uf-add-s-o');
if (minus.length > 0) {
// 合上 需要将所有的都合上
- minus.removeClass('uf-minusbutton').addClass('uf-addsquarebutton2');
+ minus.removeClass('uf-reduce-s-o').addClass('uf-add-s-o');
if (rowChildIndex.length > 0) {
var allChildRowIndex = oThis.getAllChildRowIndex(row);
$.each(allChildRowIndex, function () {
var $tr1 = $('tr[role="row"]:eq(' + parseInt(this) + ')', $tr.parent());
$tr1.css('display', 'none');
// 左侧复选区隐藏
$('#' + oThis.options.id + '_content_multiSelect >div:nth-child(' + (parseInt(this) + 1) + ')').css('display', 'none');
- $('.uf-minusbutton', $tr1).removeClass('uf-minusbutton').addClass('uf-addsquarebutton2');
+ $('.uf-reduce-s-o', $tr1).removeClass('uf-reduce-s-o').addClass('uf-add-s-o');
});
}
if (this.options.editType == 'form') {
@@ -757,7 +757,7 @@
}
} else if (plus.length > 0) {
// 展开
- plus.removeClass('uf-addsquarebutton2').addClass('uf-minusbutton');
+ plus.removeClass('uf-add-s-o').addClass('uf-reduce-s-o');
if (rowChildIndex.length > 0) {
$.each(rowChildIndex, function () {
var $tr1 = $('tr[role="row"]:eq(' + parseInt(this) + ')', $tr.parent());
@@ -819,7 +819,7 @@
var $pTr = $('#' + this.options.id + '_content_div').find('tbody').find('tr[role="row"]').eq(oThis.addRowParentIndex);
if (parentChildLength > 0) {
// 如果存在父项并且父项存在子项则需要判断父项是否展开
- var openDiv = $('.uf-addsquarebutton2', $pTr);
+ var openDiv = $('.uf-add-s-o', $pTr);
if (!(openDiv.length > 0)) {
displayFlag = 'block';
}
@@ -830,12 +830,12 @@
}
var d = $("div:eq(0)", $pTr);
- var openDiv = $('.uf-addsquarebutton2', $pTr);
- var closeDiv = $('.uf-minusbutton', $pTr);
+ var openDiv = $('.uf-add-s-o', $pTr);
+ var closeDiv = $('.uf-reduce-s-o', $pTr);
if (this.options.autoExpand) {
- var spanHtml = '<span class="uf u-grid-content-tree-span uf-minusbutton"></span>';
+ var spanHtml = '<span class="uf u-grid-content-tree-span uf-reduce-s-o"></span>';
} else {
- var spanHtml = '<span class="uf u-grid-content-tree-span uf-addsquarebutton2"></span>';
+ var spanHtml = '<span class="uf u-grid-content-tree-span uf-add-s-o"></span>';
}
if (d.length > 0 && openDiv.length == 0 && closeDiv.length == 0) {
d[0].insertAdjacentHTML('afterBegin', spanHtml);
@@ -846,7 +846,7 @@
}
}
if (openDiv.length > 0) {
- openDiv.removeClass('uf-addsquarebutton2').addClass('uf-minusbutton');
+ openDiv.removeClass('uf-add-s-o').addClass('uf-reduce-s-o');
}
}
}
@@ -979,7 +979,7 @@
parentIndex = whileRow.parentRowIndex;
whileRow = whileRow.parentRow;
var $pTr = $('#' + this.options.id + '_content_div').find('tbody').find('tr[role="row"]').eq(parentIndex);
- var openDiv = $('.uf-addsquarebutton2', $pTr);
+ var openDiv = $('.uf-add-s-o', $pTr);
if (openDiv.length > 0) {
//合着
needExpanedParent.push(parentIndex);
@@ -993,13 +993,13 @@
for (var i = needExpanedParent.length - 1; i > -1; i--) {
var index = needExpanedParent[i];
var $pTr = $('#' + this.options.id + '_content_div').find('tbody').find('tr[role="row"]').eq(index);
- var openDiv = $('.uf-addsquarebutton2', $pTr);
+ var openDiv = $('.uf-add-s-o', $pTr);
openDiv.click();
}
}
var $Tr = $('#' + this.options.id + '_content_div').find('tbody').find('tr[role="row"]').eq(rowIndex);
- var openDiv = $('.uf-addsquarebutton2', $Tr);
+ var openDiv = $('.uf-add-s-o', $Tr);
var firstDiv = $('.u-grid-content-td-div', $Tr);
if (openDiv.length > 0) openDiv.click();else firstDiv.click();
};
@@ -2258,9 +2258,9 @@
treeStyle = 'style="position:relative;';
if (row.hasChild) {
if (oThis.options.autoExpand) {
- spanStr = '<span class=" uf uf-minusbutton u-grid-content-tree-span"></span>';
+ spanStr = '<span class=" uf uf-reduce-s-o u-grid-content-tree-span"></span>';
} else {
- spanStr = '<span class=" uf uf-addsquarebutton2 u-grid-content-tree-span"></span>';
+ spanStr = '<span class=" uf uf-add-s-o u-grid-content-tree-span"></span>';
}
} else {
l += 16;
@@ -3297,19 +3297,43 @@
var row = this.dataSourceObj.rows[this.eidtRowIndex];
var inputDom = null;
- if (dohideFlag && this.editComp && this.editComp.hide) {
+ //在chrome下
+ // if (dohideFlag && this.editComp && this.editComp.hide) {
+ // this.editComp.hide();
+ // dohideFlag = false;
+ // }
+
+ // try {
+ // var inputDom = this.editComp.element.parentNode.querySelector('input');
+ // } catch (e) {}
+
+ // if (dohideFlag && inputDom) {
+ // inputDom.blur();
+ // dohideFlag = false;
+ // }
+
+ // if (dohideFlag && this.editComp && this.editComp.comp && this.editComp.comp.hide) {
+ // this.editComp.comp.hide();
+ // dohideFlag = false;
+ // }
+ // 按理说应该是使用dohideFlag做为标志,调用hide方法就不走blur(即上面注释那段)。但是为了兼容ie在第一行输入‘32424’,点击第二行,在回到一行就不可输入了
+ if (this.editComp && this.editComp.hide) {
this.editComp.hide();
- }
- if (dohideFlag && this.editComp && this.editComp.comp && this.editComp.comp.hide) {
- this.editComp.comp.hide();
+ dohideFlag = false;
}
try {
var inputDom = this.editComp.element.parentNode.querySelector('input');
} catch (e) {}
- if (dohideFlag && inputDom) {
+ if (inputDom) {
inputDom.blur();
+ dohideFlag = false;
+ }
+
+ if (this.editComp && this.editComp.comp && this.editComp.comp.hide) {
+ this.editComp.comp.hide();
+ dohideFlag = false;
}
try {
$('#' + this.options.id + '_placeholder_div').remove();
Oops, something went wrong.

0 comments on commit 8202e90

Please sign in to comment.