我已经创建了表,并在该表中进行行内编辑.
因此,在FuelZone列中,我必须显示下拉列表,在单击编辑之前,所选值将显示在表中.
You can see in below image in the table on third row In FuelZone
and FuelType
column the data is showing Spain_FZ
and Diesel
.
但当我点击编辑选项时,它在下拉选项中显示不同的值.我想设置所选的选项.
代码:
<td>
<span class="editSpan fuel_zone">{{f.fuel_zone}}</span>
<select class="form-control editInput fuel_zone" id="FuelZoneSelect" name="fuel_zone" style="display: none;">
{% for c in FuelZone %}
<option value="{{c}}" {% if f.fuel_zone == c %}selected="selected"{% endif %}>{{c}}</option>
{% endfor %}
<option value="1" data-bs-toggle="modal" data-bs-target="#valueModal" data-id="1">Add New Zone</option>
</select>
<small class="text-danger" id="err-fuel_zone"></small>
</td>
当我点击EDI时,如何设置所选选项?