File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
frameworks/keyed/preact-kr-observable/src Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,12 @@ export const Row = observer(function row({ data }) {
6
6
< tr className = { data . selected ? 'danger' : '' } >
7
7
< td className = "col-md-1" > { data . id } </ td >
8
8
< td className = "col-md-4" >
9
- < a onClick = { ( ) => rowsStore . select ( data . id ) } > { data . label } </ a >
9
+ < a id = { data . id } onClick = { rowsStore . select } > { data . label } </ a >
10
10
</ td >
11
11
< td className = "col-md-1" >
12
- < a onClick = { ( ) => rowsStore . delete ( data . id ) } >
12
+ < a onClick = { rowsStore . delete } >
13
13
< span
14
+ id = { data . id }
14
15
className = "glyphicon glyphicon-remove"
15
16
aria-hidden = "true"
16
17
> </ span >
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ import { buildData } from './data';
4
4
export class RowsStore extends Observable {
5
5
rows = [ ] ;
6
6
7
- delete ( rowIdToDelete ) {
8
- const rowIndexToDelete = this . rows . findIndex ( ( row ) => row . id === rowIdToDelete ) ;
7
+ delete ( e ) {
8
+ const rowIndexToDelete = this . rows . findIndex ( ( row ) => row . id === + e . target . id ) ;
9
9
this . rows . splice ( rowIndexToDelete , 1 ) ;
10
10
} ;
11
11
@@ -23,8 +23,8 @@ export class RowsStore extends Observable {
23
23
}
24
24
} ;
25
25
26
- select ( rowId ) {
27
- this . rows . forEach ( row => row . selected = row . id === rowId )
26
+ select ( e ) {
27
+ this . rows . forEach ( row => row . selected = row . id === + e . target . id )
28
28
} ;
29
29
30
30
runLots ( ) {
You can’t perform that action at this time.
0 commit comments