Cgridview Ajax Pages And Link

I had CGridView and all pages for gridview use ajax to upload new data, if i click to button Number of the page, for example 33, data comes, but if i tried not to click to link of the page, but tried open in new window of browser i get error because i have




if (!Yii::app()->request->isAjaxRequest) throw new CHttpException('Url should be requested via ajax only');



Question: How to make if you tried to open in new window ajax link, open current page with neccessary page?

AFAIK CGridView ajax actually requests the whole page and then takes only the grid portion of the requested page. So, unless you really need to prevent request of non ajax call, you don’t need that line.

This code is working for ajax and non ajax CGridview:




  public function actionAdmin()

  {

    $model=new MyModel('search');

    ... 

    $this->render('admin',array(

      'model'=>$model,

    ));

  }



View admin.php:




  <any html codes />

  

  <?php

  $this->widget('CGridView', array(

	'id'=>'data-grid',

 	'dataProvider'=>$model->search(),

	'columns'=>array(

             ...

             ...

         )

  ?>

  

  <any html codes />