Yii TbJsonGridView – Parser error – Solved

While using Yii framework yiibooster TbJsonGridView we usually face the problem of “Parser error!” when deleting a row from admin view.

The problem arises because, after deletion of a row the controller/admin action is called which sends the complete HTML page instead of Json of the table.

The solution is very simple and you need to take two simple steps to remedy it:

1. modify your controller/admin action like the following:


    if(isset($_GET['ajax'])) {
      $this->renderPartial('_admin', array(
       'model' => $model
    } else {


So if $_GET[‘ajax’] variable is set (which is set auto by an ajax call from TbJsonGridView) then you need to renderPartial a view called _admin. And renderPartial only sends the required Json data.

2. Create _admin.php file in the relevant view folder and copy only the JsonGridView widget code from admin into _admin view.

Cheers 🙂