@@ -33,6 +33,7 @@ class CMSFilter {
3333 this . sortOptions = document . querySelector ( '[wt-cmsfilter-element="sort-options"]' ) ;
3434 this . resultCount = document . querySelector ( '[wt-cmsfilter-element="results-count"]' ) ;
3535 this . emptyElement = document . querySelector ( '[wt-cmsfilter-element="empty"]' ) ;
36+ this . resetIx2 = this . listElement . getAttribute ( 'wt-cmsfilter-resetix2' ) || false ;
3637
3738 //Data Tracking Values
3839 this . allItems = [ ] ;
@@ -206,6 +207,7 @@ class CMSFilter {
206207 const currentPage = this . filteredItems . slice ( currentSlice , currentSlice + this . itemsPerPage ) ;
207208 currentPage . forEach ( item => {
208209 this . listElement . appendChild ( item ) ;
210+ if ( this . resetIx2 ) this . ResetInteraction ( item ) ;
209211 } ) ;
210212 }
211213 } else {
@@ -214,10 +216,6 @@ class CMSFilter {
214216 } ) ;
215217 }
216218
217- var webflow = window . Webflow || [ ] ;
218- if ( webflow ) {
219- webflow . require ( 'ix2' ) . init ( ) ;
220- }
221219 this . ToggleEmptyState ( ) ;
222220 this . UpdatePaginationDisplay ( ) ;
223221 }
@@ -292,7 +290,6 @@ class CMSFilter {
292290 this . SetActiveTags ( ) ;
293291 }
294292
295-
296293 ShowResultCount ( ) {
297294 if ( ! this . resultCount ) return ;
298295 this . resultCount . innerText = this . GetResults ( ) ;
@@ -369,7 +366,6 @@ class CMSFilter {
369366 return filters ;
370367 }
371368
372-
373369 GetDataSet ( str ) {
374370 return str . replace ( / (?: ^ \w | [ A - Z ] | \b \w ) / g, function ( word , index ) {
375371 return index === 0 ? word . toLowerCase ( ) : word . toUpperCase ( ) ;
@@ -565,6 +561,37 @@ class CMSFilter {
565561 this . ApplyFilters ( ) ;
566562 }
567563
564+ ResetInteraction ( element ) {
565+ if ( ! element ) {
566+ console . error ( 'Element not found' ) ;
567+ return ;
568+ }
569+
570+ const WebflowIX2 = window . Webflow && Webflow . require ( 'ix2' ) ;
571+ if ( ! WebflowIX2 ) {
572+ console . error ( 'Webflow IX2 engine not found.' ) ;
573+ return ;
574+ }
575+
576+ const targetElement = element . hasAttribute ( 'data-w-id' )
577+ ? element
578+ : element . querySelector ( '[data-w-id]' ) ;
579+
580+ if ( ! targetElement ) {
581+ console . warn ( 'No IX2 interaction found on the element or its children.' ) ;
582+ return ;
583+ }
584+
585+ const dataWId = targetElement . getAttribute ( 'data-w-id' ) ;
586+ if ( dataWId ) {
587+ targetElement . removeAttribute ( 'data-w-id' ) ;
588+ targetElement . setAttribute ( 'data-w-id' , dataWId ) ;
589+
590+ WebflowIX2 . init ( ) ;
591+ } else {
592+ console . warn ( 'No valid data-w-id attribute found.' ) ;
593+ }
594+ }
568595
569596 GetFilterData ( ) {
570597 let filterData = {
0 commit comments