From ee6e4968fdf6742579cfcd9ba6bbc41c6f382584 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 15 May 2014 14:15:13 +1200 Subject: [PATCH] BUG Fix grid field showing search without search component added ref: CWPBUG-133 --- javascript/GridField.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/javascript/GridField.js b/javascript/GridField.js index 746f6fbf6..09bfec7d0 100644 --- a/javascript/GridField.js +++ b/javascript/GridField.js @@ -40,16 +40,19 @@ // multiple relationships via keyboard. if(focusedElName) self.find(':input[name="' + focusedElName + '"]').focus(); - var content; - if(ajaxOpts.data[0].filter=="show"){ - content = ''; - self.addClass('show-filter').find('.filter-header').show(); - }else{ - content = ''; - self.removeClass('show-filter').find('.filter-header').hide(); - } + // Update filter + if(self.find('.filter-header').length) { + var content; + if(ajaxOpts.data[0].filter=="show") { + content = ''; + self.addClass('show-filter').find('.filter-header').show(); + } else { + content = ''; + self.removeClass('show-filter').find('.filter-header').hide(); + } - self.find('.sortable-header th:last').html(content); + self.find('.sortable-header th:last').html(content); + } form.removeClass('loading'); if(successCallback) successCallback.apply(this, arguments);