当前位置:网站首页>DCAT batch operation popup and parameter transfer
DCAT batch operation popup and parameter transfer
2022-07-29 05:51:00 【Liaoshengping】

create form
<?php
namespace App\Admin\Form;
use App\Models\Good;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;
class EditGoodsMatchForm extends Form
{
use LazyWidget;
public function form()
{
$this->select('goods_id', ' Modify the goods ')->options(Good::pluck('goods_name', 'id'));
$this->hidden('ids')->attribute('id', 'batchsp-id'); // Batch selected rows id By hiding elements Pass it along when submitting
}
public function handle($input)
{
// Get the value passed from the form
return $this->response()->success(' success ');
}
}
Row batch operation
<?php
namespace App\Admin\BatchAction;
use App\Admin\Form\EditGoodsMatchForm;
use Dcat\Admin\Grid\BatchAction;
use Dcat\Admin\Widgets\Modal;
class EditGoodsMatch extends BatchAction
{
public $title = ' Modify matching data ';
public function render()
{
$form = EditGoodsMatchForm::make();
$modal = Modal::make()
->lg()
->title($this->title)
->body($form)
->button($this->title);
$modal->onShow($this->getModalScript());
return $modal;
}
protected function getModalScript()
{
// Pop up window shows backward hidden id Write batch selected rows in the form ID
return <<<JS
// Get the selected ID Array
var key = {
$this->getSelectedKeysScript()}
//batchsp-id And The previous pop-up window is hidden and bound id Agreement
$('#batchsp-id').val(key);
JS;
}
}
Controller operation
$grid->batchActions([
new EditGoodsMatch(),
]);
Reference resources :https://blog.csdn.net/samee5/article/details/120920980
边栏推荐
猜你喜欢

July 28 ens/usd Value Forecast: ENS attracts huge profits

量化开发必掌握的30个知识点【什么是分笔逐笔数据】?

中海油集团,桌面云&网盘存储系统应用案例

Fantom (FTM) 价格将在未来几天飙升 20%

赓续新征程,共驭智存储

微信内置浏览器禁止缓存的问题

7 月 28 日 ENS/USD 价值预测:ENS 吸引巨额利润

D3.JS 纵向关系图(加箭头,连接线文字描述)

How to survive in the bear market of encryption market?

Training log 4 of the project "construction of Shandong University mobile Internet development technology teaching website"
随机推荐
Sliding switch of tab of uniapp component
微信内置浏览器禁止缓存的问题
Elastic box flex
Dao race track is booming. What are the advantages of m-dao?
剑指核心-TaoCloud全闪SDS助力构建高性能云服务
Win10 compiles ffmpeg (including ffplay)
Super simple integration HMS ml kit face detection to achieve cute stickers
超简单集成HMS ML Kit 实现parental control
“山东大学移动互联网开发技术教学网站建设”项目实训日志七
MOVE PROTOCOL全球健康宣言,将健康运动进行到底
Performance comparison | FASS iSCSI vs nvme/tcp
Bare metal cloud FASS high performance elastic block storage solution
From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run
深度学习的趣味app简单优化(适合新手)
iSCSI vs iSER vs NVMe-TCP vs NVMe-RDMA
获取水仙花数
rsync+inotyfy实现数据单项监控实时同步
The openatom openharmony sub forum was successfully held, and ecological and industrial development entered a new journey
裸金属云FASS高性能弹性块存储解决方案
极致通缩和永动机模型,将推动 PlatoFarm 爆发