I have index-ss.php And it has a search form in it,
search form
<div class="search-form" style="display:none">
<section class="panel panel-success portlet-item">
<header class="panel-heading">Search</header>
<ul class="list-group alt">
<li class="list-group-item">
<div class="wide form">
<?php $form=$this->beginWidget('CActiveForm', array(
'action'=>Yii::app()->createUrl($this->route),
'method'=>'get',
'htmlOptions'=>array('class'=>'form-horizontal'),
)); ?>
<div class="form-group">
<label class="col-sm-2 control-label">User</label>
<div class="col-sm-10">
<select class="form-control" name="User[username]" id="User_username">
<option value="">--- Select ---</option>
<?php
$userList = Profile::model()->findAll(array('order'=>'firstname'));
foreach ($userList as $value) {
echo '<option value="'.$value->user['username'].'">'.$value['firstname'].' '.$value['lastname'].'</option>';
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"><?php echo $form->label($model,'email'); ?></label>
<div class="col-sm-10">
<?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>128, 'class'=>'form-control')); ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"><?php echo $form->label($model,'superuser'); ?></label>
<div class="col-sm-10">
<?php echo $form->dropDownList($model,'superuser',$model->itemAlias('AdminStatus'), array('class'=>'form-control')); ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"><?php echo $form->label($model,'status'); ?></label>
<div class="col-sm-10">
<?php echo $form->dropDownList($model,'status',$model->itemAlias('UserStatus'), array('class'=>'form-control')); ?>
</div>
</div>
<div class="form-group">
<?php echo CHtml::submitButton(UserModule::t('Start Searching'), array('class'=>'btn btn-sm btn-primary')); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- search-form -->
</li>
</ul>
</section>
</div>
Then it would be pass onto a script above it.
$('.search-form form').submit(function(){
$.fn.yiiGridView.update('user-grid', {
data: $(this).serialize()
});
alert($(this).serialize());
return false;
});
And pass it onto this table:
$this->widget('zii.widgets.grid.CGridView', array(
'itemsCssClass'=>'table table-striped m-b-none b-b b-light',
'id'=>'user-grid',
'dataProvider'=>$model->search(),
'enableSorting'=>false,
'emptyText'=>'No entries found.',
'summaryText'=>'Showing {start}-{end} of {count} entries <span class="page-size-wrap">Display '.$pageSizeDropDown.' per page</span>',
'columns'=>array(
array(
'name' => 'username',
'header'=>'User',
'type'=>'raw',
'value' => 'CHtml::link("<strong>".UHtml::markSearch($data,"username")."</strong><br />".$data->email."<br />".$data->profile->firstname." ".$data->profile->lastname,array("admin/view","id"=>$data->id))',
'htmlOptions' => array('style' => 'width: 50%;'),
), ...etc
The table would show at first, but then when updated it will not change. It just shows the same table.