File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -131,13 +131,14 @@ class Tr {
131131 this . data = { } ;
132132 this . app = app ;
133133 this . store = store ;
134+ this . isSelected = false ;
134135 this . el = el ( 'tr' ,
135136 this . id = el ( 'td.col-md-1' ) ,
136137 el ( 'td.col-md-4' ,
137138 this . label = el ( 'a' , { onclick : e => app . select ( this . data . id ) } )
138139 ) ,
139140 el ( 'td.col-md-1' ,
140- this . remove = el ( 'a' , { onclick : e => app . remove ( this . data . id ) } ,
141+ el ( 'a' , { onclick : e => app . remove ( this . data . id ) } ,
141142 el ( 'span.glyphicon.glyphicon-remove' , { 'aria-hidden' : true } )
142143 )
143144 ) ,
@@ -156,10 +157,12 @@ class Tr {
156157 this . label . textContent = label ;
157158 }
158159
159- if ( id === selected ) {
160- this . el . classList . add ( 'danger' ) ;
161- } else {
162- this . el . classList . remove ( 'danger' ) ;
160+ if ( id === selected && ! this . isSelected ) {
161+ this . el . classList . add ( 'danger' ) ;
162+ this . isSelected = true ;
163+ } else if ( this . isSelected ) {
164+ this . el . classList . remove ( 'danger' ) ;
165+ this . isSelected = false ;
163166 }
164167
165168 this . data = { id, label } ;
Original file line number Diff line number Diff line change @@ -131,13 +131,14 @@ class Tr {
131131 this . data = { } ;
132132 this . app = app ;
133133 this . store = store ;
134+ this . isSelected = false ;
134135 this . el = el ( 'tr' ,
135136 this . id = el ( 'td.col-md-1' ) ,
136137 el ( 'td.col-md-4' ,
137138 this . label = el ( 'a' , { onclick : e => app . select ( this . data . id ) } )
138139 ) ,
139140 el ( 'td.col-md-1' ,
140- this . remove = el ( 'a' , { onclick : e => app . remove ( this . data . id ) } ,
141+ el ( 'a' , { onclick : e => app . remove ( this . data . id ) } ,
141142 el ( 'span.glyphicon.glyphicon-remove' , { 'aria-hidden' : true } )
142143 )
143144 ) ,
@@ -156,10 +157,12 @@ class Tr {
156157 this . label . textContent = label ;
157158 }
158159
159- if ( id === selected ) {
160- this . el . classList . add ( 'danger' ) ;
161- } else {
162- this . el . classList . remove ( 'danger' ) ;
160+ if ( id === selected && ! this . isSelected ) {
161+ this . el . classList . add ( 'danger' ) ;
162+ this . isSelected = true ;
163+ } else if ( this . isSelected ) {
164+ this . el . classList . remove ( 'danger' ) ;
165+ this . isSelected = false ;
163166 }
164167
165168 this . data = { id, label } ;
You can’t perform that action at this time.
0 commit comments