Hi guys,
How to show 2 different CGridView result using 2 button in one pages.
button 1 --> CGridView1. button 2–> CGridView2. The CGridView result shown based on button selection.
Welcome for any info or suggestion. Thx.
Hi guys,
How to show 2 different CGridView result using 2 button in one pages.
button 1 --> CGridView1. button 2–> CGridView2. The CGridView result shown based on button selection.
Welcome for any info or suggestion. Thx.
Hi guys,
How to render 2 different CGridView result either based on button or dropdownlist option in a same pages.
Pls give me some example or link to refer… Thanks .
// Add two buttons to your view
CHtml::submitButton('Button 1', array('name'=>'button_1', 'submit'=>array('<controller>/<action>')));
CHtml::submitButton('Button 2', array('name'=>'button_2', 'submit'=>array('<controller>/<action>')));
// Change controller action as below
// Apply your settings accordingly
public function controllerAction()
{
if (isset($_POST['button_1']))
{
$criteria=new CDbCriteria;
$criteria->condition = 'start_time < ' . time() . ' AND ' . time() . ' < end_time';
$dataProvider=new CActiveDataProvider('Campaign', array('criteria'=>$criteria));
}
elseif (isset($_POST['button_2']))
{
$criteria=new CDbCriteria;
$criteria->condition = 'start_time < ' . time() . ' AND ' . time() . ' < end_time';
$dataProvider=new CActiveDataProvider('Campaign', array('criteria'=>$criteria));
}
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
//In your view
//Add grid view widget to your view and set below property.
'dataProvider'=>$dataProvider,
thanks Aruna Attanayake for reply.
I will try work on your solution. thanks again.