HiJimlam,
I was getting model exception because i have not added the model attribute in actiontodaysdate in my controller,
Now after adding the below code i am able to view the page.
I want to sort the date with todays date in User_Next_Action field of todaysdate.php which is a datetime field.
I have added the code of todaysdate.php for your reference
public function actiontodaysdate()
{
$model=new Master('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Master']))
$model->attributes=$_GET['Master'];
$this->render('todaysdate',array(
'model'=>$model,
));
}
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view' ),
'users'=>array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('create','update' ),
'users'=>array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions'=>array('admin','delete', 'todaysdate'),
'users'=>array('admin'),
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}
todaysdate.php
<?php
/* @var $this MasterController */
/* @var $model Master */
$this->breadcrumbs=array(
'Masters'=>array('index'),
'Manage',
);
$this->menu=array(
array('label'=>'List Master', 'url'=>array('index')),
array('label'=>'Create Master', 'url'=>array('create')),
);
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
$('.search-form').toggle();
return false;
});
$('.search-form form').submit(function(){
$.fn.yiiGridView.update('master-grid', {
data: $(this).serialize()
});
return false;
});
");
?>
<h1>Manage Masters</h1>
<p>
You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>
<?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><!-- search-form -->
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'master-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'afterAjaxUpdate'=>"function(){jQuery('#Registration_Date').datepicker({'dateFormat': 'yy-mm-dd'})}",
'columns'=>array(
'Name',
'Mobile',
'Email',
array(
'name' => 'Status',
'filter' => $model->getStatusOptions(),
),
array('name' => 'Registration_Date', 'type' => 'raw', 'filter'=>$this->widget('zii.widgets.jui.CJuiDatepicker', array('model'=>$model, 'attribute'=>'Registration_Date', 'htmlOptions' => array('id' => 'Registration_Date'), 'options' => array('dateFormat' => 'yy-mm-dd')), true)),
'User_Next_Action',
'User_Remarks',
array(
'class'=>'CButtonColumn',
),
),
)); ?>