我已成功将BootstrapTable的服务器端选项与Bootstrap V4和jsp结合使用
<table class="table table-condensed table-bordered table-hover" id="position-list"
data-toggle="table"
data-url="/pages/positions/p_getRows.jsp"
data-side-pagination="server"
data-filter-control="true"
data-pagination="true"
data-click-to-select="true"
data-id-field="id"
data-page-list="[10, 25, 50, 100, ALL]"
data-show-footer="false"
data-minimum-count-columns="2"
data-pagination="true"
>
<thead>
<tr>
<th data-sortable="true" data-field="Status" data-filter-control="select">Status</th>
...
</tr>
</thead>
<tbody>
</tbody>
</table>
这里是p_getRows.jsp
ajax的示例
int fromPos=SecurityIssues.StringToInt(request.getParameter("offset"));
int limit=SecurityIssues.StringToInt(request.getParameter("limit"));
//simplified for illustration purposes
String sqlQuery="SELECT * from (select *,row_number() over (order by position_no) as RowNum from ("+...sql for all positions...+")b ) a where a.rowNum between "+fromPos+" and "+(fromPos+limit);
int numPos=...//number of total positions
%>
{
"total":<%=numPos%>,
"rows":[
<%
for (Row r:listRows) {%>
{
"Status":"<%=r.getStatus()%>",
此刻,“状态”组合框将填充BootstrapTable“看到”的数据。 (即,用户在表格中浏览的次数越多,组合框将包含的值越多)
如何通过编程方式设置带有预定义值列表的“状态”组合框?
答案 0 :(得分:0)
“黑客”解决方案是直接通过jquery访问下拉列表
$('.form-control.bootstrap-table-filter-control-status')
(用所需列标题的名称替换“状态”)
然后可以做
$('.form-control.bootstrap-table-filter-control-status').html('
<OPTION value="A">A</OPTION><OPTION value="B">B</OPTION>');
(或其他)
我希望可以使用引导程序表中的方法来获得更优雅的效果