@@ -27,18 +27,20 @@ class RowModel extends BaseModel {
2727 *
2828 */
2929 addDomListener ( ) {
30- let me = this ;
30+ let me = this ,
31+ target = me . view . gridContainer || me . view . parent ;
3132
32- me . view . parent . on ( 'rowClick' , me . onRowClick , me )
33+ target . on ( 'rowClick' , me . onRowClick , me )
3334 }
3435
3536 /**
3637 * @param args
3738 */
3839 destroy ( ...args ) {
39- let me = this ;
40+ let me = this ,
41+ target = me . view . gridContainer || me . view . parent ;
4042
41- me . view . parent . un ( 'rowClick' , me . onRowClick , me ) ;
43+ target . un ( 'rowClick' , me . onRowClick , me ) ;
4244
4345 super . destroy ( ...args )
4446 }
@@ -91,14 +93,21 @@ class RowModel extends BaseModel {
9193 }
9294
9395 /**
94- * @param {Object } data
96+ * @param {Object } event
9597 */
96- onRowClick ( { data } ) {
98+ onRowClick ( event ) {
9799 let me = this ,
98100 { view} = me ,
99- record = me . getRecord ( data . path ) ,
101+ { data} = event ,
102+ record = event . record || me . getRecord ( data . path ) ,
100103 recordId ;
101104
105+ // In a multi-body architecture, ensure we only toggle the state once per click
106+ // by restricting the state mutation to the specific body that fired the event.
107+ if ( event . body && event . body !== view ) {
108+ return
109+ }
110+
102111 if ( record ) {
103112 if ( me . hasAnnotations ( record ) ) {
104113 me . updateAnnotations ( record )
@@ -107,6 +116,9 @@ class RowModel extends BaseModel {
107116
108117 me . toggleRowSelection ( recordId ) ;
109118
119+ // Sync visual state to sibling sub-grids
120+ me . getActivePeers ( ) . forEach ( peer => peer . updateRows ( recordId ) ) ;
121+
110122 view . fire ( me . isSelectedRow ( recordId ) ? 'select' : 'deselect' , { record} )
111123 }
112124 }
0 commit comments