I have a FilteringSelect in a form and I want to get it options in order to do an alphabetical insertion of a new option.
The FilteringSelect element is:
<select name="inv_ext" id="inv_ext" data-dojo-type="dijit.form.FilteringSelect">
<option class="opt_inv_ext" value="1">Aaaaa, Aaa</option>
<option class="opt_inv_ext" value="2">Ccccc, Ccc</option>
</select>
And the Javascript code to get and proccess each option is:
dojo.query(".opt_inv_ext").forEach(function(opt, i, nodelist){
...
}
The goal is to insert the following node:
<option class="opt_inv_ext" value="3">Bbbbb, Bbb</option>
between the two existing ones using the label as the comparison value not the value attribute.
Any idea? Thanks in advance and sorry my english!
It’s easy to do if you use a store to back your list. I assume you use dojo 1.6>. Here is an example :
-In your HTML :
-In javascript :