@@ -3,27 +3,45 @@ const compositeTable = class {
33 if ( document . getElementById ( elementID ) === null ) {
44 throw "Element ID " + elementID + " not found"
55 } ;
6- this . table = d3 . select ( "#" + elementID ) . append ( "table" ) . append ( "tbody" ) ;
7- this . rows = [ ] ;
8- this . nRows = 0 ;
96 const self = this ;
10- this . addRow_ = this . table . append ( "tr" )
11- . attr ( "id" , "add-row" )
12- . append ( "td" )
13- . attr ( "colspan" , 11 )
14- . append ( "div" )
15- . classed ( "add-row-text" , true )
16- . text ( "Add new composite" )
17- . on ( "click" , function ( ) {
18- const compositeDataObj = dataObj . addCompositeData ( { idx : self . nRows } ) ;
19- self . addRow ( compositeDataObj )
20- } ) ;
7+
8+ this . container = d3 . select ( "#" + elementID )
9+ this . addRowContainer = this . container . append ( "div" )
10+ . attr ( "id" , "add-row" ) ;
11+ this . addRowIcon = this . addRowContainer . append ( "svg" )
12+ . classed ( "add-row-icon" , true )
13+ . attr ( "title" , "Add new composite" )
14+ . attr ( "xmlns" , "http://www.w3.org/2000/svg" )
15+ . attr ( "viewbox" , "0 0 185 30" )
16+ . attr ( "width" , "185" )
17+ . attr ( "height" , "30" )
18+ . on ( "click" , function ( ) {
19+ const compositeDataObj = dataObj . addCompositeData ( { idx : self . nRows } ) ;
20+ self . addRow ( compositeDataObj )
21+ } ) ;
22+ this . addRowIcon . append ( "circle" )
23+ . attr ( "cx" , 15 )
24+ . attr ( "cy" , 15 )
25+ . attr ( "r" , 15 )
26+ . attr ( "fill" , "#468C00" ) ;
27+ this . addRowIcon . append ( "path" )
28+ . attr ( "d" , "m 15 5 l 0 20 M 5 15 l 20 0" )
29+ . attr ( "stroke" , "#FFFFFF" )
30+ . attr ( "stroke-width" , 4 ) ;
31+ this . addRowIcon . append ( "text" )
32+ . attr ( "x" , 40 )
33+ . attr ( "y" , 21 )
34+ . attr ( "font-size" , 16 )
35+ . text ( "Add new composite" ) ;
36+ this . table = this . container . append ( "table" ) . append ( "tbody" ) ;
37+ this . rows = [ ] ;
38+ this . nRows = 0
2139 }
2240
2341 addRow ( compositeDataObj ) {
2442 // Add the row
2543 this . rows . push ( new compositeRow (
26- this . table . insert ( "tr" , "#add-row ") . classed ( "composite-row" , true ) ,
44+ this . table . append ( "tr" ) . classed ( "composite-row" , true ) ,
2745 this . nRows ,
2846 compositeDataObj
2947 ) ) ;
0 commit comments