jQuery(function($){ $('fieldset.ss-gridfield .action').entwine({ onclick: function(e){ var button = this; e.preventDefault(); var form = $(this).closest("form"); var field = $(this).closest("fieldset.ss-gridfield"); form.addClass('loading'); $.ajax({ headers: {"X-Get-Fragment" : 'CurrentField'}, type: "POST", url: form.attr('action'), data: form.serialize()+'&'+escape(button.attr('name'))+'='+escape(button.val()), dataType: 'html', success: function(data) { // Replace the grid field with response, not the form. field.replaceWith(data); form.removeClass('loading'); }, error: function(e) { alert(ss.i18n._t('GRIDFIELD.ERRORINTRANSACTION', 'An error occured while fetching data from the server\n Please try again later.')); form.removeClass('loading'); } }); } }); var removeFilterButtons = function() { // Remove stuff $('th').children('div').each(function(i,v) { $(v).remove(); }); } /* * Upon focusing on a filter element, move "filter" and "reset" buttons and display next to the current element * ToDo ensure filter-button state is maintained after filtering (see resetState param) * ToDo get working in IE 6-7 */ $('fieldset.ss-gridfield input.ss-gridfield-sort').entwine({ onfocusin: function(e) { // Dodgy results in IE <=7 & ignore if only one filter-field countfields = $('fieldset.ss-gridfield input.ss-gridfield-sort').length; if(($.browser.msie && $.browser.version <= 7) || countfields == 1) { return false; } var eleInput = $(this); // Remove existing
and