thanks before, Show_Teach display on the index file in a div tag with id "show_teach" (<div id="show_teach"> … show schedule … </ div>)
this my code from view and controller file ,
[size="3"][color="#006400"]This Code in View/teaching, File name is views/index.php[/color][/size]
<?php
$this->breadcrumbs=array(
'Teaching',
);?>
<h1><?php echo $this->id . ‘/’ . $this->action->id; ?></h1>
<?php echo CHtml::beginForm(); ?>
<div class="row">
<?php echo CHtml::label(‘search for subjects :’, ‘lb_search_subject’); ?>
<?php echo CHtml::textField(‘txt_search’,’’,array(‘size’=>100,‘maxlength’=>50)); ?>
</div>
<?php
echo CHtml::ajaxSubmitButton(
'search object',
array('teaching/show_Teach'),
array(
'update'=>'#show_teach',
),
array(
'type'=>'submit',
)
);
?>
<?php echo CHtml::endForm(); ?>
<div id="show_teach">…show schedule…</div>
<div id="view_teach">…get schedule…</div>
=============================================================
[color="#006400"][size="3"]this controller file : file name : TeachingController.php[/size][/color]
<?php
class TeachingController extends Controller
{
public function actionIndex()
{
$this->render('index');
}
//view objects schedule
public function actionShow_Teach ()
{
$nsearch= $_POST ['txt_search'];
$this-> RenderPartial ('teaching', array ('vsearch' => $nsearch), false, true);
Yii :: app()->end();
}
//get objects schedule
public function actionGet_teach ()
{
print_r("sucesss",true);
Yii :: app()->end();
}
}
==================================================================
[color="#006400"][size="3"]and this is file to be renderpartial : filename views/teaching.php[/size][/color]
<?php
echo "<table border='1'aligment='center' bgcolor='#4F9BC6' width='100%'>
<tr>
<th>Number</th>
<th>Objects Code</th>
<th>Objects</th>
<th>Lecturer</th>
<th>SKS</th>
<th>Class Name</th>
<th>Capacity</th>
<th>Process</th>
</tr>";
$n=0;
$idchk=0;
$tmpl="Select * from tbl_objects where objects like '%$vsearch%'";
$command->reset;
$command = Yii::app()->db->createCommand($tmpl);
$data=$command->queryAll();
foreach($data as $row):
$idchk=$idchk+1;
echo "<tr onmouseover=this.bgColor='lightblue' onmouseout=this.bgColor='#EFFDFF' bgcolor='#EFFDFF'>";
echo "<td>" . $n=$n+1 . "</td>";
echo "<td>" . $row[kdx_objects] . "</td>";
echo "<td>" . $row[objects] . "</td>";
echo "<td>" . $row[lecturer] . "</td>";
echo "<td>" . $row[sks] . "</td>";
echo "<td>" . $row[class_name] . "</td>";
echo "<td>" . $row[capacity] . "</td>";
[color="#FF0000"] echo "<td>";
echo CHtml::ajaxSubmitButton('Save',array('teaching/get_teach'),array('update'=>'#view_teach',),array('type'=>'submit',));
echo "</td>"; [/color]
endforeach;
echo "</table>";
?>