Exemplo n.º 1
0
		bulidNewExcel: function() {
			var i,
				j,
				lenCol,
				lenRow,
				currentObject;
			lenCol = config.User.initColNum;
			lenRow = config.User.initRowNum;

			for (i = 0; i < lenCol; i++) {
				currentObject = {
					sort: i,
					alias: (i + 1).toString(),
					left: i * config.User.cellWidth,
					width: config.User.cellWidth - 1,
					displayName: getDisplayName.getColDisplayName(i)
				};
				headItemCols.add(currentObject);
			}
			for (j = 0; j < lenRow; j++) {
				currentObject = {
					sort: j,
					alias: (j + 1).toString(),
					top: j * config.User.cellHeight,
					height: config.User.cellHeight - 1,
					displayName: getDisplayName.getRowDisplayName(j)
				};
				headItemRows.add(currentObject);
			}
			this.restoreSelectRegion();
		},
Exemplo n.º 2
0
		analysisColData: function(cols, startColSort) {

			//隐藏列还原
			var tempHeadCol, i, j, len, collen;
			for (i = 0; i < cols.length; i++) {
				//待修改:判定是否已存在加载类,应使用二分查询进行判定
				if (headItemCols.getIndexByAlias(cols[i].aliasY) !== -1) {
					continue;
				}
				tempHeadCol = {
					sort: startColSort + i,
					left: cols[i].left,
					width: cols[i].width,
					alias: cols[i].aliasX,
					hidden: cols[i].hidden,
					originalWidth: cols[i].originWidth,
					operProp: {}
				};
				if (!isEmptyObject(cols[i].operProp.content)) {
					tempHeadCol.operProp.content = cols[i].operProp.content;
				}
				if (!isEmptyObject(cols[i].operProp.customProp)) {
					tempHeadCol.operProp.customProp = cols[i].operProp.customProp;
				}
				if (!isEmptyObject(cols[i].operProp.border)) {
					tempHeadCol.operProp.border = cols[i].operProp.border;
				}
				tempHeadCol.displayName = getDisplayName.getColDisplayName(startColSort + i);
				if (cols[i].hidden && i > 0) {
					headItemCols.models[i - 1].set('isRightAjacentHide', true);
				}
				if (i > 0 && cols[i - 1].hidden) {
					tempHeadCol.isLeftAjacentHide = true;
				}
				headItemCols.add(tempHeadCol);
			}


			if (headItemCols.length < config.User.initColNum) {
				len = config.User.initColNum - headItemCols.length;
				collen = headItemCols.length;
				for (j = 0; j < len; j++) {
					tempHeadCol = {
						sort: collen + j,
						left: headItemCols.models[collen + j - 1].get('left') + headItemCols.models[collen + j - 1].get('width') + 1,
						width: config.User.cellWidth,
						alias: (headItemCols.length + 1).toString(),
						displayName: getDisplayName.getColDisplayName(collen + j),
					};
					headItemCols.add(tempHeadCol);
				}
			}

			function isEmptyObject(obj) {
				var prop;
				for (prop in obj) {
					return false;
				}
				return true;
			}
		},