Appearance

SpreadJS provides class names for you to customize the group by css class, you can customize group element line color , background color, button font color and background image.

<p>You can customize group area background-color or border color like this:</p> <pre><code class="hljs"><span class="hljs-selector-class">.gc-group</span>{ <span class="hljs-attribute">background-color</span>: <span class="hljs-built_in">rgb</span>(<span class="hljs-number">180</span>, <span class="hljs-number">211</span>, <span class="hljs-number">230</span>) color: <span class="hljs-number">#999999</span>; } </code></pre> <p>You can customize group line color or line width like this:</p> <pre><code class="hljs"><span class="hljs-selector-class">.gc-group-line</span>{ <span class="hljs-attribute">border-width</span>:<span class="hljs-number">2px</span>; <span class="hljs-attribute">border-style</span>:solid; <span class="hljs-attribute">border-color</span>:red; } </code></pre> <p>You can customize group dot color like this:</p> <pre><code class="hljs"><span class="hljs-selector-class">.gc-group-dot</span>{ <span class="hljs-attribute">color</span>:blue; } </code></pre> <p>You can customize group button color like this:</p> <pre><code class="hljs"><span class="hljs-selector-class">.gc-group-box</span>{ <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#fff</span>; <span class="hljs-attribute">color</span>:<span class="hljs-built_in">rgb</span>(<span class="hljs-number">8</span>, <span class="hljs-number">154</span>, <span class="hljs-number">245</span>); } </code></pre> <p>You can customize group expand (collapsed) button background-image like this:</p> <pre><code class="hljs"><span class="hljs-selector-class">.gc-group-box-expand</span>{ <span class="hljs-attribute">border-color</span>:transparent; <span class="hljs-attribute">background-image</span>: <span class="hljs-built_in">url</span>(<span class="hljs-string">'images/minus.png'</span>); <span class="hljs-attribute">background-color</span>: transparent; } <span class="hljs-selector-class">.gc-group-box-collapsed</span>{ <span class="hljs-attribute">border-color</span>:transparent; <span class="hljs-attribute">background-image</span>: <span class="hljs-built_in">url</span>(<span class="hljs-string">'images/add.png'</span>); <span class="hljs-attribute">background-color</span>: transparent; } </code></pre>
var spreadNS = GC.Spread.Sheets; window.onload = function () { var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss")); initSpread(spread); }; function initSpread(spread) { var sheet = spread.getSheet(0); sheet.suspendPaint(); // set row range group var sd = dataSource; if (sd.length > 0) { sheet.setDataSource(sd); } sheet.setColumnWidth(0, 160); sheet.setColumnWidth(1, 70); sheet.setColumnWidth(2, 90); sheet.setColumnWidth(3, 110); sheet.setColumnWidth(4, 80); sheet.setColumnWidth(6, 110); sheet.rowOutlines.group(1, 15); sheet.rowOutlines.group(1, 4); sheet.rowOutlines.group(6, 4); sheet.rowOutlines.group(11, 4); sheet.columnOutlines.group(1, 3); sheet.columnOutlines.group(1, 2); sheet.resumePaint(); };
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/en/purejs/node_modules/@grapecity/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/en/purejs/node_modules/@grapecity/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/spread/source/data/data.js" type="text/javascript"></script> <script src="$DEMOROOT$/spread/source/js/license.js" type="text/javascript"></script> <script src="app.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <div class="sample-tutorial"> <div id="ss" class="sample-spreadsheets groupAppearanceSs"></div> </div> </body> </html>
label { display:inline-block; width: 210px; } input[type="button"] { padding: 4px 6px; width: 100%; margin-bottom: 10px; } .sample-tutorial { position: relative; height: 100%; overflow: hidden; } .groupAppearanceSs{ width: 100%; height: 100%; } .desc{ padding:2px 10px; background-color:lavender; } .gc-group { background-color: rgb(180, 211, 230); color: #999999; border-width: 0px; border-style:solid; } .gc-group-box { background-color: #fff; color: rgb(8, 154, 245); border-color:rgb(32, 158, 241); } .gc-group-line{ border-width:2px; border-style:solid; border-color:rgb(137, 199, 243); } .gc-group-dot{ color:blue; } .gc-group-box-expand{ border-color:transparent; background-image: url('$DEMOROOT$/spread/source/images/minus.png'); background-color: transparent; } .gc-group-box-collapsed{ border-color:transparent; background-image: url('$DEMOROOT$/spread/source/images/add.png'); background-color: transparent; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }