@@ -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 ( ) ;
@@ -524,8 +520,10 @@ class CMSFilter {
524520 }
525521 }
526522 if ( this . allItems ) {
527- if ( this . allItems . length > 0 ) {
528- return this . allItems . length ;
523+ //trim out static elements from RenderStatic
524+ let elements = this . allItems . filter ( item => ! item . hasAttribute ( 'wt-renderstatic-element' ) ) ;
525+ if ( elements . length > 0 ) {
526+ return elements . length ;
529527 }
530528 return 0 ;
531529 }
@@ -565,6 +563,37 @@ class CMSFilter {
565563 this . ApplyFilters ( ) ;
566564 }
567565
566+ ResetInteraction ( element ) {
567+ if ( ! element ) {
568+ console . error ( 'Element not found' ) ;
569+ return ;
570+ }
571+
572+ const WebflowIX2 = window . Webflow && Webflow . require ( 'ix2' ) ;
573+ if ( ! WebflowIX2 ) {
574+ console . error ( 'Webflow IX2 engine not found.' ) ;
575+ return ;
576+ }
577+
578+ const targetElement = element . hasAttribute ( 'data-w-id' )
579+ ? element
580+ : element . querySelector ( '[data-w-id]' ) ;
581+
582+ if ( ! targetElement ) {
583+ console . warn ( 'No IX2 interaction found on the element or its children.' ) ;
584+ return ;
585+ }
586+
587+ const dataWId = targetElement . getAttribute ( 'data-w-id' ) ;
588+ if ( dataWId ) {
589+ targetElement . removeAttribute ( 'data-w-id' ) ;
590+ targetElement . setAttribute ( 'data-w-id' , dataWId ) ;
591+
592+ WebflowIX2 . init ( ) ;
593+ } else {
594+ console . warn ( 'No valid data-w-id attribute found.' ) ;
595+ }
596+ }
568597
569598 GetFilterData ( ) {
570599 let filterData = {
0 commit comments