/** * Manages all models. */ public function actionAjaxborramaterial() { $identidad = (int) $_GET['id']; $modeloaborrar = Dlistamaeriales::model()->findByPk($identidad); if (!is_null($modeloaborrar)) { $modeloaborrar->delete(); echo "BORRO"; } else { echo "NO ENCONTRO"; } }
?> </div> <?php $this->endWidget(); ?> </div><!-- form --> </div> </div> <?php if (!$model->isNewRecord) { ?> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'detalle-grid', 'itemsCssClass' => 'table table-striped table-bordered table-hover', 'dataProvider' => Dlistamaeriales::model()->search_por_lista($model->id), 'summaryText' => '->', 'columns' => array('codigo', 'cant', 'um', 'ums.desum', 'maestro.descripcion', array('htmlOptions' => array('width' => 400), 'class' => 'CButtonColumn', 'template' => '{delete}', 'buttons' => array('delete' => array('visible' => 'true', 'url' => '$this->grid->controller->createUrl("/listamateriales/ajaxborramaterial", array("id"=>$data->id))', 'options' => array('ajax' => array('type' => 'GET', 'success' => 'js:function() { $.fn.yiiGridView.update("detalle-grid");}', 'url' => 'js:$(this).attr("href")'), 'onClick' => 'Loading.show();Loading.hide(); '), 'imageUrl' => '' . Yii::app()->getTheme()->baseUrl . Yii::app()->params['rutatemaimagenes'] . 'borrador.png', 'label' => 'Ver detalle')))))); ?> <?php $createUrl = $this->createUrl('/listamateriales/agregamaterial', array("asDialog" => 1, "gridId" => 'detalle-grid', "idcabeza" => $model->id)); echo CHtml::link('Agregar ', '#', array('onclick' => "\$('#cru-frame').attr('src','{$createUrl} '); \$('#cru-dialog').dialog('open');")); ?> <?php } ?>