Answer the question
In order to leave comments, you need to log in
Why is the view not opening?
It is necessary to print the selected applications in the GridView in a new tab. I do it through js
view
<li><a onclick="printCashList()"><i class="fa fa-money"></i> Кассовый отчет</a></li>
function checkedRowsIds() {
var checkedRows = $('.select-on-check:checked');
if (checkedRows.length == 0) {
return '';
}
var idsString = '';
checkedRows.each(function (index) {
if (index == 0) {
idsString = $(this).val();
} else {
idsString += ',' + $(this).val();
}
});
return idsString;
}
function printCashList() {
var idsString = checkedRowsIds();
if (idsString.length == 0) {
return;
}
var urlUsersList = baseUrl + 'task/printCashList&id=' + idsString;
window.open(urlUsersList, '_blank');
}
public function actionPrint()
{
$ids = explode(',', Yii::$app->request->post('idsString'));
$tasks = Task::findAll($ids);
$this->renderPartial('printforms/cashlist', ['arr' => $tasks]);
}
Answer the question
In order to leave comments, you need to log in
1. what's in debug?
2. why in the post controller if you access via get?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question