public function actionAjaxCreate($field, $value, $no_ajax = 0)
 {
     $model = new PpxdPersonXDocument();
     $model->{$field} = $value;
     try {
         if ($model->save()) {
             if ($no_ajax) {
                 $this->redirect(Yii::app()->request->urlReferrer);
             }
             return TRUE;
         }
     } catch (Exception $e) {
         throw new CHttpException(500, $e->getMessage());
     }
 }
<div class="table-header">
    <?php 
    echo Yii::t('D2personModule.model', 'Ppxd Person Xdocument');
    ?>
    <?php 
    if (Yii::app()->user->checkAccess("D2person.PpxdPersonXDocument.Create")) {
        $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'ajaxButton', 'type' => 'primary', 'size' => 'mini', 'icon' => 'icon-plus', 'url' => array('//d2person/ppxdPersonXDocument/ajaxCreate', 'field' => 'ppxd_pprs_id', 'value' => $modelMain->primaryKey, 'ajax' => 'ppxd-person-xdocument-grid'), 'ajaxOptions' => array('success' => 'function (html) {$.fn.yiiGridView.update(\'ppxd-person-xdocument-grid\');}'), 'htmlOptions' => array('title' => Yii::t('D2personModule.crud_static', 'Add new record'), 'data-toggle' => 'tooltip')));
    }
    ?>
</div>

<?php 
    if (empty($modelMain->ppxdPersonXDocuments)) {
        $model = new PpxdPersonXDocument();
        $model->ppxd_pprs_id = $modelMain->primaryKey;
        $model->save();
        unset($model);
    }
    $model = new PpxdPersonXDocument();
    $model->ppxd_pprs_id = $modelMain->primaryKey;
    // render grid view
    $can_edit_ppxd = Yii::app()->user->checkAccess("D2person.PpxdPersonXDocument.Update");
    $bft = !$can_edit_ppxd ? 'false' : 'true';
    $this->widget('TbGridView', array('id' => 'ppxd-person-xdocument-grid', 'dataProvider' => $model->search(), 'template' => '{summary}{items}', 'summaryText' => '&nbsp;', 'htmlOptions' => array('class' => 'rel-grid-view'), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'ppxd_pdcm_id', 'value' => '(!' . $bft . ' && !empty($data->ppxd_pdcm_id))?$data->ppxdPdcm->pdcm_name:""', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2person/ppxdPersonXDocument/editableSaver'), 'source' => CHtml::listData(PdcmDocumentType::model()->findAll(array('limit' => 1000)), 'pdcm_id', 'itemLabel'), 'apply' => $can_edit_ppxd)), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_number', 'editable' => array('url' => $this->createUrl('//d2person/ppxdPersonXDocument/editableSaver'), 'apply' => $can_edit_ppxd)), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_issue_date', 'editable' => array('type' => 'text', 'title' => Yii::t('D2personModule.model', 'Enter issue date in format YYYY-MM-DD.'), 'url' => $this->createUrl('//d2person/ppxdPersonXDocument/editableSaver'), 'apply' => $can_edit_ppxd)), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_expire_date', 'editable' => array('type' => 'text', 'title' => Yii::t('D2personModule.model', 'Enter expire date in format YYYY-MM-DD.'), 'url' => $this->createUrl('//d2person/ppxdPersonXDocument/editableSaver'), 'apply' => $can_edit_ppxd)), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_notes', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('//d2person/ppxdPersonXDocument/editableSaver'), 'apply' => $can_edit_ppxd)), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_status', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2person/ppxdPersonXDocument/editableSaver'), 'source' => $model->getEnumFieldLabels('ppxd_status'), 'apply' => $can_edit_ppxd)), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'FALSE'), 'update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'TRUE')), 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("/d2person/ppxdPersonXDocument/delete", array("ppxd_id" => $data->ppxd_id))', 'deleteConfirmation' => Yii::t('D2personModule.crud_static', 'Do you want to delete this item?'), 'deleteButtonOptions' => array('data-toggle' => 'tooltip'), 'visible' => Yii::app()->user->checkAccess("D2person.PpxdPersonXDocument.Delete")))));
    Yii::endProfile('ppxd_pprs_id.view.grid');
}
if ((!$ajax || $ajax == 'ppxt-person-xtype-grid') && Yii::app()->user->checkAccess("D2person.PpxtPersonXType.View")) {
    $can_edit_ppxt = Yii::app()->user->checkAccess("D2person.PpxtPersonXType.Update");
    $bft = !$can_edit_ppxt ? 'false' : 'true';
    Yii::beginProfile('ppxt_pprs_id.view.grid');
    ?>