请选择 进入手机版 | 继续访问电脑版
 找回密码
 立即注册

QQ登录

只需一步,快速开始

dept_estate_dev

初级会员

35

主题

115

帖子

326

积分

初级会员

积分
326

[已处理] expand报错

dept_estate_dev
初级会员   /  发表于:2016-12-12 13:04  /   查看:5694  /  回复:12


sheet.rowOutlines.direction(GC.Spread.Sheets.Outlines.OutlineDirection.Backward);
sheet.rowOutlines.group(row, $scope.typeLength);
sheet.rowOutlines.expand(row, false);


blob973956909.png

12 个回复

倒序浏览
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-12-12 14:25:35
沙发
代码没有问题,应该是您typeLength 数量有问题,越界了
回复 使用道具 举报
dept_estate_dev
初级会员   /  发表于:2016-12-12 14:47:33
板凳
没有越界
blob72358397.png
blob810689086.png
blob594368285.png
回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-12-12 17:22:54
地板
这个需要您提供一个demo了,或者在做这个操作之前导出一个json
回复 使用道具 举报
dept_estate_dev
初级会员   /  发表于:2016-12-12 18:17:03
5#
"{"version":"10.0.1","allowUserDragDrop":false,"allowUserZoom":false,"showVerticalScrollbar":false,"scrollbarMaxAlign":true,"tabStripVisible":false,"tabStripRatio":1,"sheets":{"Sheet1":{"name":"Sheet1","frozenRowCount":3,"frozenColCount":2,"rowCount":18,"columnCount":11,"spans":[{"row":0,"rowCount":3,"col":0,"colCount":1},{"row":0,"rowCount":3,"col":1,"colCount":1}],"data":{"dataTable":{"0":{"0":{"value":"项目第三方贷款"},"1":{"value":"合计"},"2":{"value":2015,"style":{"hAlign":1}},"3":{"value":2015,"style":{"hAlign":1}},"4":{"value":2015,"style":{"hAlign":1}},"5":{"value":2016,"style":{"hAlign":1}},"6":{"value":2016,"style":{"hAlign":1}},"7":{"value":2016,"style":{"hAlign":1}},"8":{"value":2016,"style":{"hAlign":1}},"9":{"value":2017,"style":{"hAlign":1}},"10":{"value":2017,"style":{"hAlign":1}}},"1":{"2":{"value":"/OADate(42185)/","style":{"hAlign":1,"formatter":"[$-en-US]d-mmm;@"}},"3":{"value":"/OADate(42277)/","style":{"hAlign":1,"formatter":"[$-en-US]d-mmm;@"}},"4":{"value":"/OADate(42369)/","style":{"hAlign":1,"formatter":"[$-en-US]d-mmm;@"}},"5":{"value":"/OADate(42460)/","style":{"hAlign":1,"formatter":"[$-en-US]d-mmm;@"}},"6":{"value":"/OADate(42551)/","style":{"hAlign":1,"formatter":"[$-en-US]d-mmm;@"}},"7":{"value":"/OADate(42643)/","style":{"hAlign":1,"formatter":"[$-en-US]d-mmm;@"}},"8":{"value":"/OADate(42735)/","style":{"hAlign":1,"formatter":"[$-en-US]d-mmm;@"}},"9":{"value":"/OADate(42825)/","style":{"hAlign":1,"formatter":"[$-en-US]d-mmm;@"}},"10":{"value":"/OADate(42916)/","style":{"hAlign":1,"formatter":"[$-en-US]d-mmm;@"}}},"2":{"2":{"value":"Q2","style":{"hAlign":1}},"3":{"value":"Q3","style":{"hAlign":1}},"4":{"value":"Q4","style":{"hAlign":1}},"5":{"value":"Q1","style":{"hAlign":1}},"6":{"value":"Q2","style":{"hAlign":1}},"7":{"value":"Q3","style":{"hAlign":1}},"8":{"value":"Q4","style":{"hAlign":1}},"9":{"value":"Q1","style":{"hAlign":1}},"10":{"value":"Q2","style":{"hAlign":1}}},"3":{"0":{"value":"期初贷款","style":{"cellType":{"typeName":"TreeNodeCellType"}}},"1":{"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true}},"2":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true}},"3":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"C15"},"4":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"D15"},"5":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"E15"},"6":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"F15"},"7":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"G15"},"8":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"H15"},"9":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"I15"},"10":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"J15"}},"4":{"0":{"value":"新增贷款","style":{"cellType":{"typeName":"TreeNodeCellType"}}},"1":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"SUM(B6:B9)"},"2":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"SUM(C6:C9)"},"3":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"SUM(D69)"},"4":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"SUM(E6:E9)"},"5":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"SUM(F6:F9)"},"6":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"SUM(G6:G9)"},"7":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"SUM(H6:H9)"},"8":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"SUM(I6:I9)"},"9":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"SUM(J6:J9)"},"10":{"value":0,"style":{"backColor":"#e6e6e6","hAlign":2,"formatter":"#,##0.00","locked":true},"formula":"SUM(K6:K9)"}},"5":{"2":{"style":{"backColor":"#e6e6e6","locked":true}},"3":{"style":{"backColor":"#e6e6e6","locked":true}},"4":{"style":{"backColor":"#e6e6e6","locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"backColor":"#e6e6e6","locked":true}},"7":{"style":{"backColor":"#e6e6e6","locked":true}},"8":{"style":{"locked":true}},"9":{"style":{"locked":true}},"10":{"style":{"locked":true}}},"6":{"2":{"style":{"backColor":"#e6e6e6","locked":true}},"3":{"style":{"backColor":"#e6e6e6","locked":true}},"4":{"style":{"backColor":"#e6e6e6","locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"back…,"locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"backColor":"#e6e6e6","locked":true}},"7":{"style":{"backColor":"#e6e6e6","locked":true}},"8":{"style":{"locked":true}},"9":{"style":{"locked":true}},"10":{"style":{"locked":true}}},"8":{"2":{"style":{"backColor":"#e6e6e6","locked":true}},"3":{"style":{"backColor":"#e6e6e6","locked":true}},"4":{"style":{"backColor":"#e6e6e6","locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"backColor":"#e6e6e6","locked":true}},"7":{"style":{"backColor":"#e6e6e6","locked":true}},"8":{"style":{"locked":true}},"9":{"style":{"locked":true}},"10":{"style":{"locked":true}}},"9":{"2":{"style":{"backColor":"#e6e6e6","locked":true}},"3":{"style":{"backColor":"#e6e6e6","locked":true}},"4":{"style":{"backColor":"#e6e6e6","locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"backColor":"#e6e6e6","locked":true}},"7":{"style":{"backColor":"#e6e6e6","locked":true}},"8":{"style":{"locked":true}},"9":{"style":{"locked":true}},"10":{"style":{"locked":true}}},"10":{"2":{"style":{"backColor":"#e6e6e6","locked":true}},"3":{"style":{"backColor":"#e6e6e6","locked":true}},"4":{"style":{"backColor":"#e6e6e6","locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"backColor":"#e6e6e6","locked":true}},"7":{"style":{"backColor":"#e6e6e6","locked":true}},"8":{"style":{"locked":true}},"9":{"style":{"locked":true}},"10":{"style":{"locked":true}}},"11":{"2":{"style":{"backColor":"#e6e6e6","locked":true}},"3":{"style":{"backColor":"#e6e6e6","locked":true}},"4":{"style":{"backColor":"#e6e6e6","locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"backColor":"#e6e6e6","locked":true}},"7":{"style":{"backColor":"#e6e6e6","locked":true}},"8":{"style":{"locked":true}},"9":{"style":{"locked":true}},"10":{"style":{"locked":true}}},"12":{"2":{"style":{"backColor":"#e6e6e6","locked":true}},"3":{"style":{"backColor":"#e6e6e6","locked":true}},"4":{"style":{"backColor":"#e6e6e6","locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"backColor":"#e6e6e6","locked":true}},"7":{"style":{"backColor":"#e6e6e6","locked":true}},"8":{"style":{"locked":true}},"9":{"style":{"locked":true}},"10":{"style":{"locked":true}}},"13":{"2":{"style":{"backColor":"#e6e6e6","locked":true}},"3":{"style":{"backColor":"#e6e6e6","locked":true}},"4":{"style":{"backColor":"#e6e6e6","locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"backColor":"#e6e6e6","locked":true}},"7":{"style":{"backColor":"#e6e6e6","locked":true}},"8":{"style":{"locked":true}},"9":{"style":{"locked":true}},"10":{"style":{"locked":true}}},"14":{"2":{"style":{"backColor":"#e6e6e6","locked":true}},"3":{"style":{"backColor":"#e6e6e6","locked":true}},"4":{"style":{"backColor":"#e6e6e6","locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"backColor":"#e6e6e6","locked":true}},"7":{"style":{"backColor":"#e6e6e6","locked":true}},"8":{"style":{"locked":true}},"9":{"style":{"locked":true}},"10":{"style":{"locked":true}}},"15":{"2":{"style":{"backColor":"#e6e6e6","locked":true}},"3":{"style":{"backColor":"#e6e6e6","locked":true}},"4":{"style":{"backColor":"#e6e6e6","locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"backColor":"#e6e6e6","locked":true}},"7":{"style":{"backColor":"#e6e6e6","locked":true}},"8":{"style":{"locked":true}},"9":{"style":{"locked":true}},"10":{"style":{"locked":true}}},"16":{"2":{"style":{"backColor":"#e6e6e6","locked":true}},"3":{"style":{"backColor":"#e6e6e6","locked":true}},"4":{"style":{"backColor":"#e6e6e6","locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"backColor":"#e6e6e6","locked":true}},"7":{"style":{"backColor":"#e6e6e6","locked":true}},"8":{"style":{"locked":true}},"9":{"style":{"locked":true}},"10":{"style":{"locked":true}}},"17":{"2":{"style":{"backColor":"#e6e6e6","locked":true}},"3":{"style":{"backColor":"#e6e6e6","locked":true}},"4":{"style":{"backColor":"#e6e6e6","locked":true}},"5":{"style":{"backColor":"#e6e6e6","locked":true}},"6":{"style":{"backColor":"#e6e6e6","locked":true}},"7":{"style":{"backColor":"#e6e6e6","locked":true}},"8":{"style":{"locked":true}},"9":{"style":{"locked":true}},"10":{"style":{"locked":true}}}},"defaultDataNode":{"style":{"hAlign":0,"themeFont":"Body","borderLeft":{"color":"#cfcfcf","style":1},"borderTop":{"color":"#cfcfcf","style":1},"borderRight":{"color":"#cfcfcf","style":1},"borderBottom":{"color":"#cfcfcf","style":1}}}},"rowHeaderData":{"defaultDataNode":{"style":{"themeFont":"Body"}}},"colHeaderData":{"defaultDataNode":{"style":{"themeFont":"Body"}}},"selections":{"activeSelectedRangeIndex":-1,"length":0},"theme":"Office","showRowOutline":false,"rowOutlines":{"itemsData":[{"index":5,"count":4,"info":{"level":0,"collapsed":false}}]},"rowHeaderVisible":false,"colHeaderVisible":false,"isProtected":true,"index":0}}}"
回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-12-13 09:34:06
6#
您用附件发吧,中间被截断了
回复 使用道具 举报
dept_estate_dev
初级会员   /  发表于:2016-12-13 10:21:59
7#
发了

spread.json

3.01 KB, 下载次数: 106

回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-12-13 12:20:06
8#
本帖最后由 dexteryao 于 2016-12-13 12:21 编辑

您好,我测试了您的json ,没有报错。
sheet.rowOutlines.expand(5, false); 第一个参数是级别,不是row。 index.zip (3.75 KB, 下载次数: 121)
回复 使用道具 举报
dept_estate_dev
初级会员   /  发表于:2016-12-13 14:19:52
9#
能否帮忙调整以下树状菜单,在V9.0时,鼠标单击事件group的收缩都是正常的,升级到V10后,就不正常了
function TreeNodeCellType() {
                    this.typeName = "TreeNodeCellType";
            }
            TreeNodeCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();

            TreeNodeCellType.prototype.getAutoFitWidth = function (value, text, cellStyle, zoomFactor, context) {
                var level = context.sheet.rowRangeGroup.getLevel(context.row);
                var nlevel = -1;
                if (context.row < context.sheet.getRowCount() - 1) {
                    nlevel = context.sheet.rowRangeGroup.getLevel(context.row + 1);
                }

                var image;
                if (nlevel > level) {
                    image = image1;
                }
                else {
                    image = image2;
                }
                var hoffset = (level + 2) * 12;
                var imageWidth = image.width, imageMagin = 3, imageLayoutWidth = imageWidth + imageMagin * 2;

                return ns.TextCellType.prototype.getAutoFitWidth.apply(this,arguments) + imageWidth + imageMagin + hoffset + 5;
            }

            TreeNodeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
                var level = options.sheet.rowRangeGroup.getLevel(options.row);
                var nlevel = -1;
                if (options.row < options.sheet.getRowCount() - 1) {
                    nlevel = options.sheet.rowRangeGroup.getLevel(options.row + 1);
                }
                var hoffset = (level + 2) * 12;
                x += hoffset;
                w -= hoffset;

                var image;
                if (nlevel > level) {
                    image = image1;
                }
                else {
                    image = image2;
                }
                var imageWidth = image.width, imageMagin = 3, imageLayoutWidth = imageWidth + imageMagin * 2;
                x += imageLayoutWidth;
                w -= imageLayoutWidth;
                GcSpread.Sheets.CustomCellType.prototype.paint.apply(this, arguments);

//            if (options.row == options.sheet.getRowCount() - 1) return; //last row

                if (nlevel > level) {
                    var collapsed = options.sheet.rowRangeGroup.isCollapsed(options.row + 1);
                    x -= imageLayoutWidth;
                    w += imageLayoutWidth;
                    var imageX = x + imageMagin, imageY = y + h / 2 - image.height / 2;
                    x--;
                    y += h / 2 - 3;
                    ctx.save();
                    ctx.fillStyle = "black";
                    ctx.beginPath();
                    if (collapsed) {
                        ctx.moveTo(x - 5, y);
                        ctx.lineTo(x, y + 3);
                        ctx.lineTo(x - 5, y + 6);
                    } else {
                        ctx.moveTo(x, y);
                        ctx.lineTo(x, y + 5);
                        ctx.lineTo(x - 5, y + 5);
                    }
                    ctx.fill();
                    ctx.restore();
                    ctx.drawImage(image, imageX, imageY);
                }
                else {
                    x -= imageLayoutWidth;
                    w += imageLayoutWidth;
                    var imageX = x + imageMagin, imageY = y + h / 2 - image.height / 2;
                    x--;
                    y += h / 2 - 3;
                    ctx.save();
                    ctx.drawImage(image, imageX, imageY);
                    ctx.restore();
                }
            };
            // override getHitInfo to allow cell type get mouse messages
            TreeNodeCellType.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
                };
            }
            TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
                var level = hitinfo.sheet.rowRangeGroup.getLevel(hitinfo.row);
                var hoffset = (level + 2) * 12 + hitinfo.cellRect.x;
                if (hitinfo.x < hoffset && hitinfo.x > hoffset - 10) {
                    var collapsed = hitinfo.sheet.rowRangeGroup.isCollapsed(hitinfo.row + 1);
                    hitinfo.sheet.rowRangeGroup.setCollapsed(hitinfo.row, !collapsed);
                    hitinfo.sheet.invalidateLayout();
                    hitinfo.sheet.repaint();
                }
            };
回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2016-12-13 14:42:49
10#
     var collapsed = options.sheet.rowRangeGroup.isCollapsed(options.row + 1);
这些代码你没升级。

您看我给你发的demo里是好的。
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部