Yii Framework Forum: Html Missing In When Processoutput Is True In Renderpartial Call - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Html Missing In When Processoutput Is True In Renderpartial Call Rate Topic: -----

#1 User is offline   dermoinsen 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 01-January 13

Posted 02 January 2013 - 05:03 AM

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
0

#2 User is online   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 818
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 02 January 2013 - 10:50 AM

Hi this link might help you

http://www.yiiframew...in-a-cgridview/
0

#3 User is offline   dermoinsen 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 01-January 13

Posted 02 January 2013 - 12:32 PM

View Postalirz23, on 02 January 2013 - 10:50 AM, said:

Hi this link might help you

http://www.yiiframew...in-a-cgridview/


Thank you for your link. But it doesn't help me (at least I don't get it). My problem is as follows:

After the view file
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>


is rendered via renderPartial() the output is
ajax_edit.php

<input type="text" id="row-<?php echo $country->ID; ?>[name]" value="<?php echo CHtml::encode($country->name); ?>" />
<input type="text" class="input-small" id="row-<?php echo $country->ID; ?>[code]" value="<?php echo CHtml::encode($country->code); ?>" />

        <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>


So for some strange reason only the <td>-Tags are missing, everything else is fine.
Any hints?

Thank you so mich!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users