[SOLVED]RenderPartial and LinkButtons

Hi guys

Straight to my problem:

I've item and subItem.

I render in the /item/show view, with renderPartial the /subItem/admin view.

In the /subItem/admin view i want to use a linkButton like this:

<?php echo CHtml::linkButton('Delete',array(


      	  'submit'=>'',


      	  'params'=>array('command'=>'/subItem/delete','id'=>$model->id),


      	  'confirm'=>"Are you sure to delete #{$model->id}?")); ?>

but it perform just a refresh and i think it never reached the delete function in the subItemController.

What is the best way to get on with this problem?

How can I perform with linkButtons actions from the subItemController?

Hope it's clear & thank you for help.

phil

much going on here, sorry for this bump… :(

Okay now I've done it like this:

      <?php echo CHtml::linkButton('Delete',array(


      	  'submit'=>array('/subItem/delete/&id='.$model->id),


      	  'confirm'=>"Are you sure to delete #{$model->id}?")); ?>

But it think it isn't a good solution, is it?

EDIT:

Had just scanned after the $_GET['id'], when I also search after the $_POST['id'] this also works:

 <?php echo CHtml::linkButton('Delete',array(


      	  'submit'=>array('/subItem/delete/'),


      	  'params'=>array('id'=>$model->id),


      	  'confirm'=>"Are you sure to delete #{$model->id}?")); ?>

Thank you for help :)

phil

Hi, I have the same problem: linkButton not working in a render partial.

Looks like a client script not bound…

I have a page loading a subpage through Ajax. That subpage contains a linkButton(). What's the right way of doing this? I guess I need to use Chtml::clientChange().

[<?= CHtml::linkButton('x',array(


           'submit'=>array('admin'),


           'params' => array('command' => 'delete', 'id' => $poi->id),


           'confirm'=>"Delete this place?")); ?>]

And does in your case something like my solution doesn't work?

 <?php echo CHtml::linkButton('Delete',array(


           'submit'=>array('/subItem/delete/'),


           'params'=>array('id'=>$model->id),


           'confirm'=>"Are you sure to delete #{$model->id}?")); ?>

I don't get your problem completely…

Thanks for replying, i've not been working on my project since a few days. I will check that out.

Actually nothing worked, and I would say it is because my linkButton is located on a part of the page that is loaded with ajax. I need to link the onclick event on my button after the initial page load.