Sonata-Admin内联“添加新按钮”会重置所有项目

时间:2015-12-17 21:42:05

标签: symfony sonata-admin

我在Sonata-Admin中的内容被打破了。当我单击“添加新闻”按钮时,将重新加载所有内联字段并替换为空值。我通过composer更新了sonata-admin,检查了控制台是否有错误,但是一切似乎都很好,但是再也无法添加内联。

这是FormMapper初始化:

    $formMapper
        ->add('title', 'text', array('label' => 'Product title'))
        (...)
        ->add('images','sonata_type_collection', array('label' => 'Images'), array(
            'edit' => 'inline',
            'inline' => 'table',
        )) (...)

我也尝试在其中一个论坛上更新jquery.form.js,但不幸的是,这也无济于事。

这是内联项目的原始代码:

 <td style="vertical-align: top;">
    <a href="/uploads/images/stool-01.jpg" target="_blank" class="full-img-link">/stool-01.jpg</a>
    <br>267.841 Kb, 2000x1333
    <br>Original file name: <b>Stool - 01.jpg</b>
    <br><br>
    <div class="form-group ">
        <label style="width:auto;padding-right:10px" class=" control-label" for="s567415498e56e_images_0_image_delete">Удалить</label>
        <div class="">
            <div class="icheckbox_minimal" aria-checked="false" aria-disabled="false" style="position: relative;"><input type="checkbox" id="s567415498e56e_images_0_image_delete" name="s567415498e56e[images][0][image][delete]" value="1" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background-color: rgb(255, 255, 255); border: 0px; opacity: 0; background-position: initial initial; background-repeat: initial initial;"></ins></div>                             
        </div>
    </div>
</td>

这是通过ajax请求发送的新代码:

(..)                
<td class="sonata-ba-td-s5674144509ffc_images-_delete control-group">
   <input type="checkbox" id="s5674144509ffc_images_4__delete" name="s5674144509ffc[images][4][_delete]" value="1" />
</td>
<td class="sonata-ba-td-s5674144509ffc_images-image control-group">
  <div id="s5674144509ffc_images_4_image" class=""> 
     <input type="file" id="s5674144509ffc_images_4_image_file" name="s5674144509ffc[images][4][image][file]" class=" form-control" />
   </div>
</td>
(..)

0 个答案:

没有答案