Add Buefy support for enum grid filters
This commit is contained in:
		
							parent
							
								
									ef7b2ddbdd
								
							
						
					
					
						commit
						be6a1d916f
					
				
					 3 changed files with 20 additions and 0 deletions
				
			
		|  | @ -963,6 +963,12 @@ class Grid(object): | |||
|             valueless = [v for v in filtr.valueless_verbs | ||||
|                          if v in filtr.verbs] | ||||
| 
 | ||||
|             choices = [] | ||||
|             choice_labels = {} | ||||
|             if self.enums and filtr.key in self.enums: | ||||
|                 choices = list(self.enums[filtr.key]) | ||||
|                 choice_labels = self.enums[filtr.key] | ||||
| 
 | ||||
|             data[filtr.key] = { | ||||
|                 'key': filtr.key, | ||||
|                 'label': filtr.label, | ||||
|  | @ -974,6 +980,8 @@ class Grid(object): | |||
|                 'verb': filtr.verb or filtr.default_verb or filtr.verbs[0], | ||||
|                 'value': six.text_type(filtr.value) if filtr.value is not None else "", | ||||
|                 'data_type': filtr.data_type, | ||||
|                 'choices': choices, | ||||
|                 'choice_labels': choice_labels, | ||||
|             } | ||||
| 
 | ||||
|         return data | ||||
|  |  | |||
|  | @ -99,6 +99,7 @@ class ChoiceValueRenderer(FilterValueRenderer): | |||
|     """ | ||||
|     Renders value input as a dropdown/selectmenu of available choices. | ||||
|     """ | ||||
|     data_type = 'choice' | ||||
| 
 | ||||
|     def __init__(self, options): | ||||
|         self.options = options | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar