mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 22:42:16 +00:00
Merge branch 'bug-3736/FilterWidget_apply_filter_before_saving'
This commit is contained in:
+15
-12
@@ -479,8 +479,9 @@ var FHC_FilterWidget = {
|
||||
|
||||
/**
|
||||
* Event function used by the apply filter button
|
||||
* The given parameter is used to decide if the page is going to be reloaded
|
||||
*/
|
||||
_applyFilterEvent: function() {
|
||||
_applyFilterEvent: function(reload = true) {
|
||||
|
||||
var appliedFilters = [];
|
||||
var appliedFiltersOperations = [];
|
||||
@@ -505,7 +506,15 @@ var FHC_FilterWidget = {
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
FHC_FilterWidget._failOrReload(data, textStatus, jqXHR);
|
||||
|
||||
if (reload === true)
|
||||
{
|
||||
FHC_FilterWidget._failOrReload(data, textStatus, jqXHR);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log(FHC_AjaxClient.getError(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -577,6 +586,9 @@ var FHC_FilterWidget = {
|
||||
|
||||
if ($("#customFilterDescription").val() != "")
|
||||
{
|
||||
// Apply the filter before saving it, without reloading the page
|
||||
FHC_FilterWidget._applyFilterEvent(false);
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
"widgets/Filters/saveCustomFilter",
|
||||
{
|
||||
@@ -585,16 +597,7 @@ var FHC_FilterWidget = {
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
|
||||
// If menu is present
|
||||
if (FHC_FilterWidget._hideMenu != true)
|
||||
{
|
||||
// If a success and refreshSideMenuHook is a valid function then call it to refresh the side menu
|
||||
if (typeof refreshSideMenuHook == "function")
|
||||
{
|
||||
refreshSideMenuHook();
|
||||
}
|
||||
}
|
||||
FHC_FilterWidget._failOrReload(data);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user