dongshai2022 2019-04-09 14:53 采纳率: 100%
浏览 19

如何修复手工渲染表格

I'm creating a form view at hand, and I'm following this tutorial (here) .

Apparently my form is working, the problem is being in fields that have dependencies. The "unit" field depends on the "Company" field, when I change the "company" field, the following message appears: "A widget with class name 'form' has not been bound to the controller".

To understand better, I am putting my "fields.yaml" file and my code below.

fields:
    company:
        label: Empresa
        emptyOption: '---'
        span: auto
        type: dropdown
    unit:
        label: Unidade
        span: auto
        dependsOn:
            - company
        type: dropdown
public function onShowCreateOpportunity()
    {
        $model = new \CRM\Events\Models\Opportunity;
        $config = $this->makeConfig('$/crm/events/models/opportunity/fields.yaml');
        $config->arrayName = 'Opportunity';
        $config->model = $model;
        $widget = $this->makeWidget('Backend\Widgets\Form', $config);
        $widget->form = $model;
        $widget->bindToController();

        $this->vars['model'] = $model;
        $this->vars['widget'] = $widget; //its for test

        return $this->makePartial('views/sales/sales_new', [
            'widget' => $widget, //its for test
        ]);
    }
<div id="popupSales">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="popup">&times;</button>            
            <h3 class="modal-title" align="center">Nova Oportunidade</h3>            
        </div>

        <?= Form::open() ?>
        <div class="modal-body">
            <div class="row">

                <div class="col-sm-12" style="margin-top: 20px;">                   
                        <?= $widget->render() ?>                                       
                </div>

            </div>            
        </div>

        <div class="modal-footer" style="margin-top: 5px;">         
            <div class="loading-indicator-container">
                <button data-request="onCreateNew" class="btn btn-primary">
                            Cadastrar
                        </button> 

                <button
                    type="button"
                    class="btn btn-primary"
                    data-dismiss="popup">
                    Fechar
                </button>
            </div> 
        </div>
        <?= Form::close() ?>
</div>

As I mentioned above, the form is displaying, it is showing the correct values in the "COMPANY" field, however, when I select any "Company" the "UNIT" field does not load and shows the message I quoted above.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 linux驱动,linux应用,多线程
    • ¥20 我要一个分身加定位两个功能的安卓app
    • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
    • ¥15 IAR程序莫名变量多重定义
    • ¥15 (标签-UDP|关键词-client)
    • ¥15 关于库卡officelite无法与虚拟机通讯的问题
    • ¥15 目标检测项目无法读取视频
    • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
    • ¥100 求采集电商背景音乐的方法
    • ¥15 数学建模竞赛求指导帮助