| @@ -130,8 +130,22 @@ | ||
| 130 | 130 | }); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | function wppm_pl_reset_filter(is_archieved){ |
| 134 | + // clear advanced filter UI + cookie BEFORE requesting the list, | |
| 135 | + // otherwise this request still sends the stale tb_proj_list_filters | |
| 136 | + // cookie and the reset only takes effect on the next click | |
| 137 | + jQuery("#tb-created-by").val(null).trigger("change"); | |
| 138 | + jQuery("#tb-assigned").val(null).trigger("change"); | |
| 139 | + jQuery("#tb-category").val(null).trigger("change"); | |
| 140 | + jQuery("#tb-start-date").val(""); | |
| 141 | + jQuery("#tb-end-date").val(""); | |
| 142 | + jQuery("#tb-advanced-panel").removeClass("tb-open"); | |
| 143 | + jQuery("#tb-backdrop").removeClass("active"); | |
| 144 | + jQuery("#tb-active-filters").html(''); | |
| 145 | + window.projectFilters = { created_by: [], assigned: [], category: [], start_date: "", end_date: "" }; | |
| 146 | + document.cookie = "tb_proj_list_filters=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; | |
| 147 | + | |
| 134 | 148 | jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 135 | 149 | var dataform=new FormData(jQuery('#wppm_project_list_frm')[0]); |
| 136 | 150 | dataform.append("action", 'wppm_get_project_list'); |
| 137 | 151 | dataform.append("wppm_project_filter", 'all'); |
| @@ -140,8 +154,11 @@ | ||
| 140 | 154 | dataform.append("order", 'ASC'); |
| 141 | 155 | dataform.append("is_frontend", '1'); |
| 142 | 156 | dataform.append("page", wppm_admin.page); |
| 143 | 157 | dataform.append("is_archieved",is_archieved); |
| 158 | + // send explicit empty filters so the server doesn't fall back to | |
| 159 | + // the (possibly not-yet-expired) tb_proj_list_filters cookie | |
| 160 | + dataform.append("filters", JSON.stringify({})); | |
| 144 | 161 | jQuery(document).trigger('wppm_reset_project_dataform', [dataform]); |
| 145 | 162 | jQuery.ajax( { |
| 146 | 163 | url: wppm_admin.ajax_url, |
| 147 | 164 | type: 'POST', |
| @@ -147,9 +164,9 @@ | ||
| 147 | 164 | type: 'POST', |
| 148 | 165 | data: dataform, |
| 149 | 166 | processData: false, |
| 150 | 167 | contentType: false |
| 151 | - }) | |
| 168 | + }) | |
| 152 | 169 | .done(function( response ) { |
| 153 | 170 | jQuery('#wppm_project_container').html(response); |
| 154 | 171 | }); |
| 155 | 172 | } |