Skip to content

QSelect Filtering #350

Answered by hochwe
hochwe asked this question in Q&A
Discussion options

You must be logged in to vote

I ended up solving this myself. I found #146 which explained how it should be implemented. Notably, I should have been using the "keyup" event, rather than the "filter" event.

class QSelectWithFilter(jp.QSelect):

	def __init__(self, **kwargs):
		super().__init__(**kwargs)
		self.options = kwargs.get('options', [])
		self.initial_options = kwargs.get('options', [])
		self.use_input = True
		self.allowed_events = ['input', 'remove', 'add', 'new_value', 'filter', 'filter_abort', 'keyup', 'focus',
		                       'blur']
		self.on('keyup', self.filter_function)
		self.on('blur', self.reset)
		self.on('input', self.reset)

	def reset(self, msg):
		self.options = self.initial_options

	

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hochwe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant