我在测试表单控件时发现奇怪的结果。
正常选择控制:
var table = $('#CustomerList').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "api/customer/all"
"columnDefs": [
{
"targets": 7,
"render": function(data, type, row, meta){
return '<a href="/qms/public/customer/' + row[0] + '/edit">Edit</a>';
}
}
]
});
做同样的&lt; AUI:选择&GT;:
<select class="form-control " name="input_nb_players_min" id="input_nb_players_min">
<%out.write( "<option value=\"test3\" label =\"test3\" />" ); %> //works fine
<%= "<option value=\"test6\" label =\"test6\" />" %>//works fine
<%System.out.println( "<option value=\"test3\" label =\"test3\" />" );%> //works fine
</select>
有人可以分享一下吗?
提前thx。答案 0 :(得分:1)
您可以按照以下代码作为带有所选值的动态选项的示例:
<aui:select name="title">
<%for(int i = 0; i < listOfOptions.size(); i++){
Object option = listOfOptions.get(i);
boolean selected = false;
if(user.getTitle().equals(option.getTitle())){
selected = true;
} %>
<aui:option label=<%=option.getTitle() %> value="<%=option.getValue() %>" selected=<%=selected %> />
<%} %>
</aui:select>