Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Clistview Update

$
0
0
Hi,
I would appreciate help with my problem.

I have a CListView to show uploaded files inside a CActiveForm:

<?php 
	$this->widget('zii.widgets.CListView', array(
		    'dataProvider'=>$arrayDataProviderAttList,
		    'itemView'=>'_attList',
		    'id'=>'attList',
		     ));
?>


with script in form source code:

<?php
Yii::app()->clientScript->registerScript('ajaxUpdate',
"
//javascript function to update the listview using ajax
function updateItemList(){
    $.fn.yiiListView.update('attList');
    return false;
}

", CClientScript::POS_READY);
?>


and _attList as follows:

<?php 
echo $data->FileName;
echo $data->Size;
echo CHtml::ajaxLink('Delete',array('deleteAttachment','attID'=>$data->ID),
                array(	'type'=>'POST',
                		'success'=>'function(){updateItemList()}'
                	  ),
                array('confirm'=>'Really want to delete item?',
                    'id'=>'delete-'.$data->ID));  
?>


In my controller function, actionDeleteAttachment, I delete attachment and try to send back updated data. Unfortunatelly, I was not able to get the right syntax how to return changed $arrayDataProviderAttList for CListView...
Could someone please advice me?
Thank you for your help.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>