0
我使用select2] 1和django-countries为了给用户下拉可能的国家。我现在想:(1)分裂下拉或(2)重新排列物品/国家的顺序,即:Select2 + Django:设置首选列表项目
目前,我得到一个字母顺序排列的列表:
- select country
- Afghanistan
- Albania
- Algeria
...
- Kenya
...
- Zimbabwe
我想是: (1)
- select country
- Germany
- Austria
- Switzerland
---------------------------
- Afghanistan
- Albania
- Algeria
...
- Kenya
...
- Zimbabwe
或(2)
- select country
- Germany
- Austria
- Switzerland
- Afghanistan
- Albania
- Algeria
...
- Kenya
...
- Zimbabwe
这是我JS:
$(document).ready(function() {
$("#id_nationality").select2({
default: 'Germany',
placeholder: 'select country'
});
});
我用脆皮表格的形式呈现
嗨!您是否设法使用COUNTRIES_FIRST _BREAK使用此选择并将'required'传递给select元素? –