[BUGFIX] EM 6.0 add clear search icon
authorJigal van Hemert <jigal@xs4all.nl>
Mon, 22 Oct 2012 21:47:03 +0000 (23:47 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Tue, 23 Oct 2012 17:49:24 +0000 (19:49 +0200)
Add clear search button to the jQuery dataTables search box

Change-Id: I83b57e0db29f7a948461ffdeab6375dfd16a4ad3
Fixes: #42286
Releases: 6.0
Reviewed-on: http://review.typo3.org/15897
Reviewed-by: Nicole Cordes
Tested-by: Nicole Cordes
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/extensionmanager/Resources/Public/JavaScript/main.js

index d51e67e..fe9704f 100644 (file)
@@ -4,6 +4,11 @@ jQuery(document).ready(function() {
        jQuery('td[title]').tooltip({offset: [-10, -60], position: 'bottom right'});
        jQuery("#typo3-extension-configuration-forms ul").tabs("div.category");
 
+       jQuery('#resetSearch').live('click', function (e) {
+               datatable.fnFilter('');
+       });
+
+       resetSearchField();
 });
 
 function getUrlVars() {
@@ -71,7 +76,8 @@ function bindActions() {
                                success: updateExtension
                        });
                });
-       })
+       });
+
 }
 
 function updateExtension(data) {
@@ -131,4 +137,21 @@ function removeExtension(data) {
        } else {
                TYPO3.Flashmessage.display(TYPO3.Severity.error, TYPO3.l10n.localize('extensionList.removalConfirmation.title'), data.message, 15);
        }
+}
+
+function resetSearchField() {
+       var dataTablesFilter = find(".dataTables_filter");
+       jQuery('.dataTables_wrapper').find('.dataTables_filter').append(jQuery('<span />', {
+               'class':'t3-icon t3-icon-actions t3-icon-actions-input t3-icon-input-clear t3-tceforms-input-clearer',
+               'id':'resetSearch',
+               'style':'display:none'
+       }));
+       jQuery('#typo3-extension-list_filter').mouseout(function() {
+               jQuery(this).find('#resetSearch').css('display', 'none');
+       });
+       jQuery('#typo3-extension-list_filter').mouseover(function() {
+               if (jQuery(this).find('input').val()) {
+                       jQuery(this).find('#resetSearch').css('display', 'inline-block');
+               }
+       })
 }
\ No newline at end of file