就改下CellTypes 的命名空间就好了。
TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
- window.onload = function () {
- var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), { sheetCount: 1 });
- // get spread object
- // var spread = GC.Spread.Sheets.findControl(document.getElementById('ss'));
-
- var sheet = spread.getActiveSheet();
- var defaultStyle = sheet.getDefaultStyle();
- defaultStyle.cellType = new TipCellType();
- sheet.setDefaultStyle(defaultStyle);
- };
-
- function TipCellType() {
-
- }
- TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
- TipCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
- return {
- x: x,
- y: y,
- row: context.row,
- col: context.col,
- cellStyle: cellStyle,
- cellRect: cellRect,
- sheetArea: context.sheetArea
- };
- }
- TipCellType.prototype.processMouseEnter = function (hitinfo) {
- if (!this._toolTipElement) {
- var div = document.createElement("div");
- $(div).css("position", "absolute")
- .css("border", "1px #C0C0C0 solid")
- .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
- .css("font", "9pt Arial")
- .css("background", "white")
- .css("padding", 5);
-
- this._toolTipElement = div;
- }
- $(this._toolTipElement).text("Cell [R:" + hitinfo.row + "] : [C:" + hitinfo.col + "]")
- .css("top", hitinfo.y + 15)
- .css("left", hitinfo.x + 15);
- $(this._toolTipElement).hide();
- document.body.insertBefore(this._toolTipElement, null);
- $(this._toolTipElement).show("fast");
- };
- TipCellType.prototype.processMouseLeave = function (hitinfo) {
- if (this._toolTipElement) {
- document.body.removeChild(this._toolTipElement);
- this._toolTipElement = null;
- }
- };
复制代码
你说的颜色选择器,不太清楚您具体用的什么,看下您使用选择器的接口 |