@@ -20,13 +20,7 @@ class CellRowModel extends CellModel {
2020 * @member {String} cls='neo-selection-cellrowmodel'
2121 * @protected
2222 */
23- cls : 'neo-selection-cellrowmodel' ,
24- /**
25- * Storing the node ids
26- * @member {String[]} selectedRows=[]
27- * @protected
28- */
29- selectedRows : [ ]
23+ cls : 'neo-selection-cellrowmodel'
3024 }
3125
3226 /**
@@ -35,12 +29,14 @@ class CellRowModel extends CellModel {
3529 onCellClick ( data ) {
3630 let me = this ,
3731 { view} = me ,
38- record = view . getRecord ( data . data . currentTarget ) ,
39- rowId = view . getRowId ( record ) ;
32+ record = me . getRecord ( data . data . path ) ;
4033
41- if ( rowId ) {
42- me . selectedRows = [ rowId ] ;
43- view . createViewData ( true )
34+ if ( record ) {
35+ if ( me . hasAnnotations ( record ) ) {
36+ me . updateAnnotations ( record )
37+ } else {
38+ me . toggleRowSelection ( record [ view . store . getKeyProperty ( ) ] , true ) // silent
39+ }
4440 }
4541
4642 super . onCellClick ( data )
@@ -54,35 +50,30 @@ class CellRowModel extends CellModel {
5450 { view} = me ,
5551 { store} = view ,
5652 countRecords = store . getCount ( ) ,
57- rowId = me . selectedRows [ 0 ] || view . getRowId ( store . getAt ( 0 ) ) ,
58- record = view . getRecord ( rowId ) ,
53+ keyProperty = store . getKeyProperty ( ) ,
54+ recordId = me . selectedRows [ 0 ] || store . getAt ( 0 ) [ keyProperty ] ,
55+ record = store . get ( recordId ) ,
5956 index = store . indexOf ( record ) ,
60- newIndex = ( index + step ) % countRecords ,
61- id ;
57+ newIndex = ( index + step ) % countRecords ;
6258
6359 while ( newIndex < 0 ) {
6460 newIndex += countRecords
6561 }
6662
67- id = view . getRowId ( store . getAt ( newIndex ) ) ;
63+ record = store . getAt ( newIndex ) ;
6864
69- if ( id ) {
70- me . selectedRows = [ id ] ;
71- view . createViewData ( true )
65+ if ( me . hasAnnotations ( record ) ) {
66+ me . updateAnnotations ( record )
67+ } else {
68+ recordId = record [ keyProperty ] ;
69+
70+ if ( recordId ) {
71+ me . selectRow ( recordId , true ) // silent
72+ }
7273 }
7374
7475 super . onNavKeyRow ( step )
7576 }
76-
77- /**
78- *
79- */
80- unregister ( ) {
81- this . selectedRows = [ ] ;
82- this . view . createViewData ( ) ;
83-
84- super . unregister ( )
85- }
8677}
8778
8879export default Neo . setupClass ( CellRowModel ) ;
0 commit comments