mikeabrahamsen/Flask-Meld

Meld with selectbox

systematicanet opened this issue · 2 comments

I'm trying to get a working selctbox without luck. Visualization is right but when I select an item component reset.. Seem init call is done every change I made in selectbox then value is right but selected item is always the first.
Here are my component code

select_macroaree.html


<div>
	<label for="selectmacroaree">Macroaree</label>
	<select meld:model.prevent="selezionato" meld:click="set_macroarea" class="uk-select" id="selectmacroaree" name="selectmacroaree"  >
		{% for macro in macroaree %}
			<option value="{{ macro.id|trim }}">{{ macro.text }}</option>
		{% endfor %}
	</select>
</div>

select_macroaree.py


class SelectMacroaree(Component):
	def __init__(self,  id=None, **kwargs):
		super().__init__(id=id, **kwargs)
		self.selezionato = kwargs.get('value', '0')
		myresult = listaMacroAreeDict()
		myresult.insert(0,{'id':0, 'text':'Tutte'})
		self.macroaree = myresult

	def set_macroarea(self):
		print(self.selezionato)


Even a suggestion for...?

Hey there, was able to make some time to dig into this. It should be fixed with commit 44b9f0a which has been included in release 0.10.0. Upgrade to the newest version and give it a try