Forum Replies Created
-
AuthorPosts
-
April 29, 2024 at 4:05 pm in reply to: Clear input field value when the magnifying glass is clicked again #47981
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterIt’s not that simple I’m afraid. The checkbox gets checked when the user clicks on the container “.asp_option” element.
An event handler is attached to it (native), which then changes the checkbox property to checked/unchecked, after that it fires the following event:checkboxElement.dispatchEvent(new Event('asp_chbx_change'));However you can attach to that event:
jQuery(function($){ let t; t = setInterval(()=>{ if ( typeof WPD !== 'undefined' && typeof WPD.dom !== 'undefined' ) { WPD.dom('input').on('asp_chbx_change', function(){ console.log('hey') });; } }, 100); });Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterHi,
If by any chance the date is stored in a mysql datetime format, or something similar to that – and not as timestamp – then there might be a way to achieve that without a single line of code.
The idea is to treat the datetime field as a “string”. Datetime is stored like
2024-12-31 23:59:59– which is very lucky for us, as the year is the only 4 digit string to match.Therefore creating a drop-down/radio/checkbox filter with simply the year values like this will actually match the year: https://i.imgur.com/P5zdZvQ.png
If the field is stored as datetime, this will always match the year, as it’s the only 4 digit value in the field.Doing a range type with this method is not possible. However if you were have a separate custom field to only store the year, then you will be able to also use the range slider filter as well.
Ernest Marcinko
KeymasterI think so, it does not use jQuery, but it’s native. However I think you can use a helper method to disregard the event handlers, something like:
jQuery(function($){ let t; t = setInterval(()=>{ if ( typeof WPD !== 'undefined' && typeof WPD.dom !== 'undefined' ) { WPD.dom('.asp_option').off(); clearInterval(t); } }, 100); });Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterFor the initial auto populate there is a separate ordering. You can “bypass” it with this setup: https://i.imgur.com/29ETa0l.png
Ernest Marcinko
KeymasterYou cannot access this content.
April 25, 2024 at 1:37 pm in reply to: The Enter key causes issues when used with two or more forms. #47946Ernest Marcinko
KeymasterYou cannot access this content.
-
AuthorPosts