Process advanced search results

Hi,

I followed a tutorial to enable the Advanced search in the index file of a table like this:


<?php

/* @var $this TakeController */

/* @var $dataProvider CActiveDataProvider */


$this->breadcrumbs=array(

	'Takes',

);


$this->menu=array(

	array('label'=>'Create Take', 'url'=>array('create')),	

	array('label'=>'Manage Take', 'url'=>array('admin')),

);

Yii::app()->clientScript->registerScript('search', "

$('.search-button').click(function(){

    $('.search-form').toggle();

    return false;

});

$('.search-form form').submit(function(){

    $.fn.yiiListView.update('takelistview', {        

        data: $(this).serialize()

    });

    return false;

});

");

?>


<h1>Takes</h1>


<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>

<div class="search-form" style="display:none">

<?php  $this->renderPartial('_search',array(

    'model'=>$model,

)); ?>

</div>


<?php $this->widget('zii.widgets.CListView', array(

	'dataProvider'=>$dataProvider,

	'itemView'=>'_view',

	'id'=>'takelistview',

	'sortableAttributes'=>array('id', 'data'')

)); ?>

I would like to know if there is a way to process the output of the advanced search. I know that with $dataprovider I can access all the records for this table, but I want to access only the filtered ones. In particular, I want to get the attribute “data” for each record in order to enable the download for all filtered records. I took a look at $.fn.yiiListView and CListView but I don’t understand what to do. Can you help me? Thanks!

Hi,

For your information

  1. After you click advanced search submit button. you will get filtered data in dataprovider.

  2. Dataprovider data is passed into _view.

  3. In _view you can process all the data ,because you are getting all data in the view.