| @@ -201,8 +201,13 @@ | ||
| 201 | 201 | }); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | function wppm_tl_reset_filter(){ |
| 205 | + // clear advanced filters + cookie BEFORE requesting the list, | |
| 206 | + // otherwise this request still sends the stale tb_list_filters | |
| 207 | + // cookie and the reset only takes effect on the next click | |
| 208 | + resetFilters('list'); | |
| 209 | + | |
| 205 | 210 | jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 206 | 211 | var dataform=new FormData(jQuery('#wppm_task_list_frm')[0]); |
| 207 | 212 | dataform.append("action", 'wppm_get_task_list'); |
| 208 | 213 | dataform.append("wppm_task_filter", 'all'); |
| @@ -221,13 +226,12 @@ | ||
| 221 | 226 | type: 'POST', |
| 222 | 227 | data: dataform, |
| 223 | 228 | processData: false, |
| 224 | 229 | contentType: false |
| 225 | - }) | |
| 230 | + }) | |
| 226 | 231 | .done(function( response ) { |
| 227 | 232 | jQuery('#wppm_task_container').html(response); |
| 228 | 233 | }); |
| 229 | - resetFilters('list'); | |
| 230 | 234 | } |
| 231 | 235 | |
| 232 | 236 | function wppm_task_search_filter(){ |
| 233 | 237 | var task_search = jQuery("#wppm_task_search_filter").val(); |
| @@ -354,8 +358,23 @@ | ||
| 354 | 358 | }); |
| 355 | 359 | } |
| 356 | 360 | |
| 357 | 361 | function wppm_tl_reset_grid_view_filter(){ |
| 362 | + // clear advanced filters + cookie BEFORE requesting the list, | |
| 363 | + // otherwise this request still sends the stale tb_filters cookie | |
| 364 | + // and the advanced filters never actually get reset | |
| 365 | + jQuery("#tb-created-by").val(null).trigger("change"); | |
| 366 | + jQuery("#tb-assigned").val(null).trigger("change"); | |
| 367 | + jQuery("#tb-priority").val(null).trigger("change"); | |
| 368 | + jQuery("#tb-start-date").val(""); | |
| 369 | + jQuery("#tb-end-date").val(""); | |
| 370 | + jQuery("#tb-advanced-panel").removeClass("tb-open"); | |
| 371 | + jQuery("#tb-backdrop").removeClass("active"); | |
| 372 | + jQuery("#tb-active-filters").html(''); | |
| 373 | + window.filters = { created_by: [], assigned: [], priority: [], start_date: "", end_date: "" }; | |
| 374 | + document.cookie = "tb_filters=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; | |
| 375 | + window.localStorage.removeItem('wppm_task_filter'); | |
| 376 | + | |
| 358 | 377 | jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 359 | 378 | var dataform=new FormData(jQuery('#wppm_view_project_task')[0]); |
| 360 | 379 | jQuery(document).trigger('wppm_tl_reset_grid_view_filter_dataform', [dataform]); |
| 361 | 380 | dataform.append("action", 'wppm_view_project_tasks'); |
| @@ -374,9 +393,9 @@ | ||
| 374 | 393 | type: 'POST', |
| 375 | 394 | data: dataform, |
| 376 | 395 | processData: false, |
| 377 | 396 | contentType: false |
| 378 | - }) | |
| 397 | + }) | |
| 379 | 398 | .done(function( response ) { |
| 380 | 399 | jQuery('#wppm_task_container').html(response); |
| 381 | 400 | }); |
| 382 | 401 | } |