O
O
Oversec2016-09-22 11:49:10
Yii
Oversec, 2016-09-22 11:49:10

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>

print.js
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');
}

in controller
public function actionPrint()
    {
        $ids = explode(',', Yii::$app->request->post('idsString'));
        $tasks = Task::findAll($ids);

        $this->renderPartial('printforms/cashlist', ['arr' => $tasks]);
    }

It takes me to a blank page. But if there are errors in the controller, then it displays them to me, but it does not render the page in a new tab. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-09-22
@Oversec

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 question

Ask a Question

731 491 924 answers to any question