I face a problem from renderPArtial button. I have a product listing page and the product a lot. So i create a dropdownlist base on the category to allow user add product in the list. Where user click add list, it will generate the info include a button(ajaxbutton() that use to trigger CJuiDialog box) using append method. The problem is everytime i append the new row of data, the button id still the same id(yt0), this make the button trigger the add product list button's controller (the Addlist button is preload in the page) and not runner it own controller function. Can anyone tell me how to solve it? i have try to fix the id in ajaxbutton and in wont work, controller is not trigger. i summarize the code only for create button, below is the code:
in the View
<script type="text/javascript">
<script type="text/javascript">
function createButton(){
var button ='<?php echo CHtml::ajaxButton('Edit',array('ajax' => array(
'type'=>'POST',
'dataType'=>'json',
'data'=>array('counter'=>$itemFormInfo['counter'],'server'=>$itemFormInfo['server'],'productType'=>$itemFormInfo['productType']),
'url'=>CController::createUrl('sell/loadDialog'),
'success'=>'function(data){
$("#uploadBox").dialog("open");
}',
'async' => true,
),
)) ?>';
$("#test").append(button);
}
</script>
</script>
<?php
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id'=>'uploadBox',
// additional javascript options for the dialog plugin
'options'=>array(
//'title'=>'Upload Image',
'autoOpen'=>false,
'width'=>'auto',
),
));
$this->endWidget('zii.widgets.jui.CJuiDialog');
// this is the button that already exits when page load
CHtml::Button('Add',array('ajax' =>array('type'=>'POST', 'dataType'=>'json',
'data'=>array('somedata'),
'url'=>CController::createUrl('sell/addButton'),
'success'=>'function(data){
createButton();
}'),));
?>
<div id="test"></div>
controller // assume i just want to trigger the createButton() function to create the ajax button
public function actionAddButton(){
}
the output will be all button id is the same (id=yt0);

Help













