function SortHyperlinkCellType() {
}
SortHyperlinkCellType.prototype = new GC.Spread.Sheets.CellTypes.HyperLink();
SortHyperlinkCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
var hitInfo = { x: x, y: y, row: context.row, col: context.col, cellRect: cellRect, sheetArea: context.sheetArea, sheet: context.sheet };
if (x > cellRect.x + cellRect.width - cellRect.height) {
hitInfo.isReservedLocation = true;
}
return hitInfo;
};
SortHyperlinkCellType.prototype.processMouseUp = function (hitInfo) {
if (hitInfo.isReservedLocation) {
var sheet = hitInfo.sheet, sheetArea = hitInfo.sheetArea,
row = hitInfo.row, col = hitInfo.col;
var tag = sheet.getTag(row, col, sheetArea) || {};
tag.ascending = !tag.ascending;
sheet.setTag(row, col, tag, sheetArea);
sheet.sortRange(0, 0, -1, -1, true, [{ index: col, ascending: tag.ascending }]);
}
};
SortHyperlinkCellType.prototype.paint = function (ctx, value, x, y, width, height, style, context) {
GC.Spread.Sheets.CellTypes.HyperLink.prototype.paint.apply(this, arguments);
var margin = 3;
var gap = 1;
var color = "red";
var tag = context.sheet.getTag(context.row, context.col, context.sheetArea);
ctx.save();
if(!tag || tag && tag.ascending){
ctx.beginPath();
ctx.fillStyle = color;
ctx.moveTo(x+width-height+margin,y+height/2-gap );
ctx.lineTo(x+width-margin,y+height/2-gap);
ctx.lineTo(x+width-height/2,y + margin);
ctx.closePath();
ctx.fill();
}
if(!tag || tag && !tag.ascending){
ctx.beginPath();
ctx.fillStyle = color;
ctx.moveTo(x+width-height+margin,y+height/2+gap);
ctx.lineTo(x+width-margin,y+height/2+gap);
ctx.lineTo(x+width-height/2,y+height - margin);
ctx.closePath();
ctx.fill();
}
ctx.restore();
};
SortHyperlinkCellType.prototype.processMouseDown = function (hitInfo) {
};
SortHyperlinkCellType.prototype.processMouseMove = function (hitInfo) {
};
SortHyperlinkCellType.prototype.processMouseEnter = function (hitInfo) {
};
SortHyperlinkCellType.prototype.processMouseLeave = function (hitInfo) {
};
之前来论坛看到这个 单列排序的,想咨询下 多列一起做为排序条件,应该怎么弄,而且,怎么恢复默认排序(这个点击正序倒序之后,无法恢复默认排序) |