当前位置:网站首页>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
边栏推荐
- 如何零代码制作深度学习的趣味app(适合新手)
- “山东大学移动互联网开发技术教学网站建设”项目实训日志二
- Print out all prime numbers between 1-100
- dcat 批量操作弹窗及参数传递
- Dao race track is booming. What are the advantages of m-dao?
- MySQL decompressed version windows installation
- Markdown语法
- Flink connector Oracle CDC 实时同步数据到MySQL(Oracle12c)
- Record the SQL injection vulnerability of XX company
- Extreme deflation and perpetual motion machine model will promote the outbreak of platofarm
猜你喜欢

Laravel service container (Application of context binding)

马斯克推崇的柏拉图式元宇宙,PlatoFarm早已验证出答案

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

与张小姐的春夏秋冬(2)

Huawei 2020 school recruitment written test programming questions read this article is enough (Part 2)

“山东大学移动互联网开发技术教学网站建设”项目实训日志一

Madonna "hellent" bought $1.3 million NFT boring ape, which is now considered too expensive

Read and understand move2earn project - move

How to survive in the bear market of encryption market?

Strategic cooperation with many institutions shows the strength of the leading company of platofarm yuancosmos
随机推荐
Training log 6 of the project "construction of Shandong University mobile Internet development technology teaching website"
完全去中心化的编程模式,不需要服务器,也不需要ip,就像一张漫无目的的网络、四处延伸
Detailed steps of JDBC connection to database
rsync+inotyfy实现数据单项监控实时同步
Crypto giants all in metauniverse, and platofarm may break through
Flink connector Oracle CDC 实时同步数据到MySQL(Oracle12c)
SQL修复重复数据
What is nmap and how to use it
Some opportunities for young people in rural brand building
Simple optimization of interesting apps for deep learning (suitable for novices)
Novice introduction: download from PHP environment to thinkphp6 framework by hand
Flink connector Oracle CDC 实时同步数据到MySQL(Oracle19c)
DeFi 2.0的LaaS协议,重振DeFi赛道发展的关键
深度学习的趣味app简单优化(适合新手)
Changed crying, and finally solved cannot read properties of undefined (reading 'parsecomponent')
Training log III of "Shandong University mobile Internet development technology teaching website construction" project
“山东大学移动互联网开发技术教学网站建设”项目实训日志三
Machine learning makes character recognition easier: kotlin+mvvm+ Huawei ml Kit
Go|gin quickly use swagger
Use QSS to style the form