<script type='text/javascript'>
jQuery('#usong-grid a.for-update').live('click',function() {
var url = $(this).attr('href');
$.get(url,function(res){
//alert(res);
});
$.fn.yiiGridView.update("usong-grid", {});
return false;
});
</script>
<?php
function clickBasket($data)
{
return Yii::app()->createUrl( "usong/basket",
array( "id" => $data->usong_id, "ajax"=>"yes" ) );
}
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'usong-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
...
array(
'class'=>'CButtonColumn',
'template' => '{basket} {download} {view} {update} {delete}',
'buttons'=>array(
'basket' => array(
'label' => "В корзину",
'url' => 'clickBasket($data)',
'options'=>array(
'class'=>'for-update',
),
'imageUrl' => Yii::app()->request->baseUrl.'/images/basket.png',
'visible' => '$data->inBasket()?false:true'
),
)
),
),
));
?>
Yii Справочник v0.05 © 2007-2024 Igor Salnikov aka SunDoctor