标签:selected option lazy view foreach arch mod sel 多选
{field: ‘flag‘, title: __(‘Flag‘), searchList: {"hot":__(‘Flag hot‘),"index":__(‘Flag index‘),"recommend":__(‘Flag recommend‘)}, operate:‘FIND_IN_SET‘, formatter: Table.api.formatter.label}
<div class="form-group"> <label class="control-label col-xs-12 col-sm-2">{:__(‘Flag‘)}:</label> <div class="col-xs-12 col-sm-8"> <select id="c-flag" data-rule="required" class="form-control selectpicker" multiple="" name="row[flag][]"> {foreach name="flagList" item="vo"} <option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option> {/foreach} </select> </div> </div>
<div class="form-group"> <label class="control-label col-xs-12 col-sm-2">{:__(‘Flag‘)}:</label> <div class="col-xs-12 col-sm-8"> <select id="c-flag" data-rule="required" class="form-control selectpicker" multiple="" name="row[flag][]"> {foreach name="flagList" item="vo"} <option value="{$key}" {in name="key" value="$row.flag"}selected{/in}>{$vo}</option> {/foreach} </select> </div> </div>
6.5 controller
public function _initialize() { parent::_initialize(); $this->view->assign("flagList", $this->model->getFlagList()); }
6.6 model
public function getFlagList() { return [‘hot‘ => __(‘Flag hot‘), ‘index‘ => __(‘Flag index‘), ‘recommend‘ => __(‘Flag recommend‘)]; }
标签:selected option lazy view foreach arch mod sel 多选
原文地址:https://www.cnblogs.com/CanyingV/p/13293212.html