dcat-admin icon indicating copy to clipboard operation
dcat-admin copied to clipboard

数据表单一对多,保存正常,再编辑时不显示关联的数据

Open suzhiF opened this issue 3 years ago • 4 comments
trafficstars

  • Laravel Version: 8.83.6
  • PHP Version: 7.4.3
  • Dcat Admin Version: 2.2.0

suzhiF avatar Mar 31 '22 05:03 suzhiF

截个图看看

laradocs avatar Mar 31 '22 15:03 laradocs

如图,二次编辑时,一对多的省市县联动,数据应该填充进去,然后又被load给置为空了,且不同行数据 要干扰? 微信截图_20220519192206 微信截图_20220519192615

yavana avatar May 19 '22 11:05 yavana

帮看看

yavana avatar May 19 '22 11:05 yavana

$form->hasMany('addr',"继续添加工作地点", function ($form) { $form->row(function (Form\Row $form) { $form->width(3) ->select('province_id','省份') ->options('/getProvince') ->placeholder('选择省份') ->load('city_id', '/getCity') ->required(); $form->width(3) ->select('city_id','城市') ->placeholder('选择城市') ->load('district_id', '/getDistrict') ->required(); $form->width(3) ->select('district_id','区县') ->placeholder('选择区县') ->required(); }); });

yavana avatar May 19 '22 11:05 yavana

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 16 '22 02:11 stale[bot]

需要model先with,参考表单关联关系文档 eg: $builder = new Inbound(['items']); return Form::make($builder, function (Form $form) { }

keepanote avatar Jan 08 '23 20:01 keepanote