33< link href ="../src/themes/night.css " rel ="stylesheet " type ="text/css " />
44< link href ="../src/css/sgds.css " rel ="stylesheet " type ="text/css " />
55< style >
6+ body {
7+ background : var (--sgds-bg-default );
8+ color : var (--sgds-color-default );
9+ }
10+
11+ .theme-toggle {
12+ max-width : 1200px ;
13+ margin : 18px auto 0 auto;
14+ padding : 0 18px ;
15+ }
16+
617 .container {
718 max-width : 1200px ;
819 margin : 0 auto 36px auto;
1930 }
2031</ style >
2132
33+ < div class ="theme-toggle ">
34+ < sgds-switch id ="night-mode-toggle "> Night mode</ sgds-switch >
35+ </ div >
36+
2237<!-- Basic table -->
2338< div class ="container ">
2439 < h3 > Basic</ h3 >
2540 < sgds-data-table currentPage ="10 " dataLength ="23 " itemsPerPage ="5 ">
2641 < sgds-data-table-row >
2742 < sgds-data-table-head > #</ sgds-data-table-head >
2843 < sgds-data-table-head > First name</ sgds-data-table-head >
29- < sgds-data-table-head > Last name</ sgds-data-table-head >
30- < sgds-data-table-head > Username</ sgds-data-table-head >
44+ < sgds-data-table-head sorting > Last name</ sgds-data-table-head >
45+ < sgds-data-table-head sorting > Username</ sgds-data-table-head >
3146 </ sgds-data-table-row >
3247 < sgds-data-table-row >
3348 < sgds-data-table-cell > 1</ sgds-data-table-cell >
@@ -373,7 +388,7 @@ <h3>Server Mode (mode="server")</h3>
373388 < sgds-data-table-row >
374389 < sgds-data-table-head sorting sortKey ="id "> ID</ sgds-data-table-head >
375390 < sgds-data-table-head sorting sortKey ="name "> Name</ sgds-data-table-head >
376- < sgds-data-table-head sorting sortKey =" region " > Region</ sgds-data-table-head >
391+ < sgds-data-table-head > Region</ sgds-data-table-head >
377392 </ sgds-data-table-row >
378393 </ sgds-data-table >
379394</ div >
@@ -385,7 +400,7 @@ <h3>Header and Cell Props (sorting, sortKey, width)</h3>
385400 < sgds-data-table-row >
386401 < sgds-data-table-head width ="88 "> ID</ sgds-data-table-head >
387402 < sgds-data-table-head sorting sortKey ="name "> Name</ sgds-data-table-head >
388- < sgds-data-table-head sorting sortKey =" role " > Role</ sgds-data-table-head >
403+ < sgds-data-table-head > Role</ sgds-data-table-head >
389404 < sgds-data-table-head sorting sortKey ="score " width ="120 " textAlign ="right "> Score</ sgds-data-table-head >
390405 </ sgds-data-table-row >
391406
@@ -410,6 +425,39 @@ <h3>Header and Cell Props (sorting, sortKey, width)</h3>
410425 </ sgds-data-table >
411426</ div >
412427
428+ <!-- Default sort -->
429+ < div class ="container ">
430+ < h3 > Default Sort</ h3 >
431+ < sgds-data-table currentPage ="1 " dataLength ="4 " itemsPerPage ="4 ">
432+ < sgds-data-table-row >
433+ < sgds-data-table-head sorting sortKey ="id "> ID</ sgds-data-table-head >
434+ < sgds-data-table-head sorting sortKey ="name " ariasort ="ascending "> Name</ sgds-data-table-head >
435+ < sgds-data-table-head > Role</ sgds-data-table-head >
436+ </ sgds-data-table-row >
437+
438+ < sgds-data-table-row id ="default-sort-row-1 ">
439+ < sgds-data-table-cell > 2</ sgds-data-table-cell >
440+ < sgds-data-table-cell > Alice</ sgds-data-table-cell >
441+ < sgds-data-table-cell > Engineer</ sgds-data-table-cell >
442+ </ sgds-data-table-row >
443+ < sgds-data-table-row id ="default-sort-row-2 ">
444+ < sgds-data-table-cell > 4</ sgds-data-table-cell >
445+ < sgds-data-table-cell > Ben</ sgds-data-table-cell >
446+ < sgds-data-table-cell > Analyst</ sgds-data-table-cell >
447+ </ sgds-data-table-row >
448+ < sgds-data-table-row id ="default-sort-row-3 ">
449+ < sgds-data-table-cell > 1</ sgds-data-table-cell >
450+ < sgds-data-table-cell > Chloe</ sgds-data-table-cell >
451+ < sgds-data-table-cell > Manager</ sgds-data-table-cell >
452+ </ sgds-data-table-row >
453+ < sgds-data-table-row id ="default-sort-row-4 ">
454+ < sgds-data-table-cell > 3</ sgds-data-table-cell >
455+ < sgds-data-table-cell > Darren</ sgds-data-table-cell >
456+ < sgds-data-table-cell > Designer</ sgds-data-table-cell >
457+ </ sgds-data-table-row >
458+ </ sgds-data-table >
459+ </ div >
460+
413461<!-- Row colspan example (5 data rows, 5 columns) -->
414462< div class ="container ">
415463 < h3 > Row Colspan Example (5 data rows, 5 columns)</ h3 >
@@ -463,6 +511,13 @@ <h3>Row Colspan Example (5 data rows, 5 columns)</h3>
463511</ div >
464512
465513< script type ="module ">
514+ const nightModeToggle = document . getElementById ( "night-mode-toggle" ) ;
515+
516+ nightModeToggle ?. addEventListener ( "sgds-change" , event => {
517+ const isNight = event . target ?. checked === true ;
518+ document . documentElement . classList . toggle ( "sgds-night-theme" , isNight ) ;
519+ } ) ;
520+
466521 // Set rowData on multi-select rows
467522 document . getElementById ( "ms-row-1" ) . rowData = { id : 1 , name : "John Doe" } ;
468523 document . getElementById ( "ms-row-2" ) . rowData = { id : 2 , name : "Jane Doe" } ;
@@ -478,6 +533,12 @@ <h3>Row Colspan Example (5 data rows, 5 columns)</h3>
478533 document . getElementById ( "sort-row-2" ) . rowData = { id : 2 , name : "Adam" , role : "Engineer" , score : 82 } ;
479534 document . getElementById ( "sort-row-3" ) . rowData = { id : 3 , name : "Nora" , role : "Manager" , score : 75 } ;
480535
536+ // Set rowData for default sort sample
537+ document . getElementById ( "default-sort-row-1" ) . rowData = { id : 2 , name : "Alice" , role : "Engineer" } ;
538+ document . getElementById ( "default-sort-row-2" ) . rowData = { id : 4 , name : "Ben" , role : "Analyst" } ;
539+ document . getElementById ( "default-sort-row-3" ) . rowData = { id : 1 , name : "Chloe" , role : "Manager" } ;
540+ document . getElementById ( "default-sort-row-4" ) . rowData = { id : 3 , name : "Darren" , role : "Designer" } ;
541+
481542 // Mock API-driven pagination demo for server mode table
482543 const serverTable = document . getElementById ( "server-table" ) ;
483544 const totalRows = 50 ;
0 commit comments