Prevent multi-click for grid filters "Save Defaults" button
This commit is contained in:
		
							parent
							
								
									0d9c5a078b
								
							
						
					
					
						commit
						b37981e83f
					
				
					 2 changed files with 9 additions and 2 deletions
				
			
		|  | @ -357,6 +357,8 @@ | ||||||
|       loading: false, |       loading: false, | ||||||
|       ajaxDataUrl: ${json.dumps(grid.ajax_data_url)|n}, |       ajaxDataUrl: ${json.dumps(grid.ajax_data_url)|n}, | ||||||
| 
 | 
 | ||||||
|  |       savingDefaults: false, | ||||||
|  | 
 | ||||||
|       data: ${grid.component_studly}CurrentData, |       data: ${grid.component_studly}CurrentData, | ||||||
|       rowStatusMap: ${json.dumps(grid_data['row_status_map'])|n}, |       rowStatusMap: ${json.dumps(grid_data['row_status_map'])|n}, | ||||||
| 
 | 
 | ||||||
|  | @ -589,6 +591,7 @@ | ||||||
|                       this.firstItem = data.first_item |                       this.firstItem = data.first_item | ||||||
|                       this.lastItem = data.last_item |                       this.lastItem = data.last_item | ||||||
|                       this.loading = false |                       this.loading = false | ||||||
|  |                       this.savingDefaults = false | ||||||
|                       this.checkedRows = this.locateCheckedRows(data.checked_rows) |                       this.checkedRows = this.locateCheckedRows(data.checked_rows) | ||||||
|                       if (success) { |                       if (success) { | ||||||
|                           success() |                           success() | ||||||
|  | @ -600,6 +603,7 @@ | ||||||
|                           duration: 2000, // 4 seconds |                           duration: 2000, // 4 seconds | ||||||
|                       }) |                       }) | ||||||
|                       this.loading = false |                       this.loading = false | ||||||
|  |                       this.savingDefaults = false | ||||||
|                       if (failure) { |                       if (failure) { | ||||||
|                           failure() |                           failure() | ||||||
|                       } |                       } | ||||||
|  | @ -609,6 +613,7 @@ | ||||||
|                   this.data = [] |                   this.data = [] | ||||||
|                   this.total = 0 |                   this.total = 0 | ||||||
|                   this.loading = false |                   this.loading = false | ||||||
|  |                   this.savingDefaults = false | ||||||
|                   if (failure) { |                   if (failure) { | ||||||
|                       failure() |                       failure() | ||||||
|                   } |                   } | ||||||
|  | @ -805,6 +810,7 @@ | ||||||
|           }, |           }, | ||||||
| 
 | 
 | ||||||
|           saveDefaults() { |           saveDefaults() { | ||||||
|  |               this.savingDefaults = true | ||||||
| 
 | 
 | ||||||
|               // apply current filters as normal, but add special directive |               // apply current filters as normal, but add special directive | ||||||
|               this.applyFilters({'save-current-filters-as-defaults': true}) |               this.applyFilters({'save-current-filters-as-defaults': true}) | ||||||
|  |  | ||||||
|  | @ -60,8 +60,9 @@ | ||||||
|         <b-button @click="saveDefaults()" |         <b-button @click="saveDefaults()" | ||||||
|                   icon-pack="fas" |                   icon-pack="fas" | ||||||
|                   icon-left="save" |                   icon-left="save" | ||||||
|                   class="control"> |                   class="control" | ||||||
|           Save Defaults |                   :disabled="savingDefaults"> | ||||||
|  |           {{ savingDefaults ? "Working, please wait..." : "Save Defaults" }} | ||||||
|         </b-button> |         </b-button> | ||||||
|     % endif |     % endif | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar