BootStrap复选框多选,页面初始化选中处理
以isExecuted
字段为例数据库设置为varchar
类型
新增页面
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">部门协调:</label>
<div class="col-sm-7 flex-nowrap">
<div class="checkbox-box m-l" th:each="dict : ${@dict.getType('tb_sale_contracts_exec')}">
<input type="checkbox" th:id="${'isExecuted_' + dict.dictCode}" name="isExecuted"
th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'isExecuted_' + dict.dictCode}"
th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
</div>
</div>
修改页面
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">部门协调:</label>
<div class="col-sm-7" th:with="type=${@dict.getType('tb_sale_contracts_exec')}">
<label th:each="dict : ${type}" class="check-box">
<input name="isExecuted" type="checkbox" th:value="${dict.dictValue}" th:text="${dict.dictLabel}" th:attr="checked=${tbEarlySalesApply.isExecuted.contains(dict.dictValue)?true:false}">
</label>
</div>
</div>
</div>
</div>
原文地址:https://blog.csdn.net/hexianfan/article/details/143577974
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!