| @@ -192,8 +192,14 @@ | ||
| 192 | 192 | }); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | function wppm_tl_reset_filter(){ |
| 196 | + // clear advanced filters + cookie BEFORE requesting the list, | |
| 197 | + // otherwise this request still sends the stale tb_list_filters | |
| 198 | + // cookie and the reset only takes effect on the next click | |
| 199 | + setListFilterCookie({}); | |
| 200 | + resetFilters('list'); | |
| 201 | + | |
| 196 | 202 | jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 197 | 203 | var dataform=new FormData(jQuery('#wppm_task_list_frm')[0]); |
| 198 | 204 | dataform.append("action", 'wppm_get_task_list'); |
| 199 | 205 | dataform.append("wppm_task_filter", 'all'); |
| @@ -211,14 +217,12 @@ | ||
| 211 | 217 | type: 'POST', |
| 212 | 218 | data: dataform, |
| 213 | 219 | processData: false, |
| 214 | 220 | contentType: false |
| 215 | - }) | |
| 221 | + }) | |
| 216 | 222 | .done(function( response ) { |
| 217 | 223 | jQuery('#wppm_task_container').html(response); |
| 218 | 224 | }); |
| 219 | - setListFilterCookie({}); | |
| 220 | - resetFilters('list'); | |
| 221 | 225 | } |
| 222 | 226 | |
| 223 | 227 | function wppm_task_search_filter(){ |
| 224 | 228 | var task_search = jQuery("#wppm_task_search_filter").val(); |
| @@ -251,8 +255,9 @@ | ||
| 251 | 255 | var dataform=new FormData(jQuery('#wppm_view_project_task')[0]); |
| 252 | 256 | jQuery(document).trigger('wppm_display_grid_view_dataform', [dataform]); |
| 253 | 257 | dataform.append("action", 'wppm_get_task_list_card_view'); |
| 254 | 258 | dataform.append("task_search", task_search); |
| 259 | + dataform.append("wppm_task_filter",wppm_task_filter); | |
| 255 | 260 | dataform.append("public_projects", '1'); |
| 256 | 261 | <?php if(!empty($this->shortcode_attr['project'])){ ?> |
| 257 | 262 | dataform.append("wppm_project_attr","<?php echo esc_attr($this->shortcode_attr['project']); ?>"); |
| 258 | 263 | <?php } ?> |
| @@ -340,8 +345,23 @@ | ||
| 340 | 345 | }); |
| 341 | 346 | } |
| 342 | 347 | |
| 343 | 348 | function wppm_tl_reset_grid_view_filter(){ |
| 349 | + // clear advanced filters + cookie BEFORE requesting the list, | |
| 350 | + // otherwise this request still sends the stale tb_filters cookie | |
| 351 | + // and the advanced filters never actually get reset | |
| 352 | + jQuery("#tb-created-by").val(null).trigger("change"); | |
| 353 | + jQuery("#tb-assigned").val(null).trigger("change"); | |
| 354 | + jQuery("#tb-priority").val(null).trigger("change"); | |
| 355 | + jQuery("#tb-start-date").val(""); | |
| 356 | + jQuery("#tb-end-date").val(""); | |
| 357 | + jQuery("#tb-advanced-panel").removeClass("tb-open"); | |
| 358 | + jQuery("#tb-backdrop").removeClass("active"); | |
| 359 | + jQuery("#tb-active-filters").html(''); | |
| 360 | + window.filters = { created_by: [], assigned: [], priority: [], start_date: "", end_date: "" }; | |
| 361 | + document.cookie = "tb_filters=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; | |
| 362 | + window.localStorage.removeItem('wppm_task_filter'); | |
| 363 | + | |
| 344 | 364 | jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 345 | 365 | var dataform=new FormData(jQuery('#wppm_view_project_task')[0]); |
| 346 | 366 | jQuery(document).trigger('wppm_tl_reset_grid_view_filter_dataform', [dataform]); |
| 347 | 367 | dataform.append("action", 'wppm_view_project_tasks'); |
| @@ -359,9 +379,9 @@ | ||
| 359 | 379 | type: 'POST', |
| 360 | 380 | data: dataform, |
| 361 | 381 | processData: false, |
| 362 | 382 | contentType: false |
| 363 | - }) | |
| 383 | + }) | |
| 364 | 384 | .done(function( response ) { |
| 365 | 385 | jQuery('#wppm_task_container').html(response); |
| 366 | 386 | }); |
| 367 | 387 | } |