Hi all,
first of all: Happy new year to all of you!
I am not completely new to Yii, but it is the first time I am trying to rely on the built-in AJAX features and I’m not completely sure I got it right.
I print out a really basic table (based on CGridView) in which the last column contains two links (CHtml::ajaxLink). These two buttons allow to online edit or delete a row via AJAX. Every row in the table has an ID (i.e. "row-5", based on $data->ID).
What I want to archiv is as follows: A click on the edit button replaces the content inside the <tr>-tag with some input fields and the edit and delete buttons are beeing replaced by a submit and a cancel button.
The problem is: In the AJAX view which is rendered via the renderPartial method with the processOutput option=true all the <td>-tags are missing and I can’t figure out why. Any hints? The code is as follows:
CountryController.php
public function actionAjaxEdit($id)
{
$data=$this->loadModel($id);
$this->renderPartial('ajax_edit', array('country'=>$data), false, true);
}
ajax_edit.php
<td><input type="text" id="row-<?php echo $country->ID; ?>[name]" value="<?php echo CHtml::encode($country->name); ?>" /></td>
<td><input type="text" class="input-small" id="row-<?php echo $country->ID; ?>[code]" value="<?php echo CHtml::encode($country->code); ?>" /></td>
<td class="right">
<div class="btn-group" style="margin: 0;">
<?php
echo CHtml::ajaxLink('<i class="icon-ok"></i>',array("country/ajaxdisplay", "id" => $country->ID),array("update" => "#row-".$country->ID),array("class"=>"btn btn-small", "id"=>"ok-".$country->ID));
?>
</div>
</td>
The dynamically loaded content is perfectly placed where it should be but as I said: The <td>-tags are all missing, just the content inside of them (<input …>, <div class="btn-group" …>) are inserted.
Any ideas how I could fix this?
Thanks so much!
dermoinsen