码迷,mamicode.com
首页 > 其他好文 > 详细

fastadmin 下拉框(多选)

时间:2020-07-13 15:16:47      阅读:320      评论:0      收藏:0      [点我收藏+]

标签:selected   option   lazy   view   foreach   arch   mod   sel   多选   

1 mysql

 技术图片

2 js

{field: ‘flag‘, title: __(‘Flag‘), searchList: {"hot":__(‘Flag hot‘),"index":__(‘Flag index‘),"recommend":__(‘Flag recommend‘)}, operate:‘FIND_IN_SET‘, formatter: Table.api.formatter.label}

3 add.html

<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>

4 edit.html

<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‘)];
}

fastadmin 下拉框(多选)

标签:selected   option   lazy   view   foreach   arch   mod   sel   多选   

原文地址:https://www.cnblogs.com/CanyingV/p/13293212.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!