A
A
Airslip2017-04-03 15:07:08
Yii
Airslip, 2017-04-03 15:07:08

How to delete multiple entries at once in the backend panel?

It is necessary to make it possible to delete several records at once by pressing one button. That is, to the left of each entry, add a checkbox and at the bottom of the page the "delete" button, by clicking on which, the marked entries are deleted.
87146424422c444cb59c60b36ec0e83a.jpg
Question: can this be done using standard Yii2 tools? If not, then tell me where is the template for this crud-table?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-04-03
@Airslip

Regarding making checkboxes:
www.yiiframework.com/doc-2.0/yii-grid-checkboxcolu...
And then a simple button, js collects id-shniks and sends it as a post for deletion. You can wrap the widget in a form and submit. And in the action itself, we delete it via deleteAll()( www.yiiframework.com/doc-2.0/yii-db-activerecord.h... ) or foreach in it find()and delete(), if necessary, that events would work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question