File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -252,20 +252,15 @@ class varienGrid {
252252 bindFilterFields ( ) {
253253 // Use event delegation on document body to catch all filter keypresses
254254 // This survives AJAX reloads since body doesn't get replaced
255- if ( ! document . body . _gridFilterDelegated ) {
255+ // Track per-grid to support multiple grids on the same page
256+ document . body . _gridFilterDelegated = document . body . _gridFilterDelegated || { } ;
257+ if ( ! document . body . _gridFilterDelegated [ this . containerId ] ) {
256258 document . body . addEventListener ( 'keypress' , ( event ) => {
257- // Check if this is a filter field in our grid
258259 if ( event . target . matches ( `#${ this . containerId } .filter input, #${ this . containerId } .filter select` ) ) {
259260 this . filterKeyPress ( event ) ;
260261 }
261262 } ) ;
262- document . body . _gridFilterDelegated = true ;
263- }
264-
265- // Also try direct binding as fallback
266- const filters = document . querySelectorAll ( '#' + this . containerId + ' .filter input, #' + this . containerId + ' .filter select' ) ;
267- for ( let i = 0 ; i < filters . length ; i ++ ) {
268- filters [ i ] . addEventListener ( 'keypress' , this . filterKeyPress . bind ( this ) ) ;
263+ document . body . _gridFilterDelegated [ this . containerId ] = true ;
269264 }
270265 }
271266
You can’t perform that action at this time.
0 commit comments