'Add Searchable dropdown menu in odoo using js and python
I am new to odd-python and I have to create a dropdown with search input box in one of my template, but I am not sure how to create or find relatable source code.
So far I was able to do below code
<div>
<label for="html">
<h3>
<div style="color:white;">Part Number </div>
</h3>
</label>
<select data-type="search" class="product_select" data-search="true">
<t t-foreach="widget.pro_name" t-as="partner">
<option t-att-value="partner['id']" widget="domain" options="{'model': 'model_name'}">
<h3>
<t t-esc="partner['name']" />
</h3>
</option>
</t>
</select>
</div>
Even after setting data-search="true" in select element, Its still not showing input type, can anyone please help me or guide for this.
Solution 1:[1]
You can use Datalists, it is similar to <select> elements
<label for="part_number" class="form-label">Part Number</label>
<input class="form-control" list="PartNumberOptions" id="part_number" placeholder="Type to search..."/>
<datalist id="PartNumberOptions">
</datalist>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kenly |
