[font=“Arial”]here’s my dependent dropdown php code:[/font]
[font="Courier New"]<?php $find= new SomeModule;
$form=$this->beginWidget('CActiveForm', array(
'action'=> Yii::app()->createUrl('someurl'),
'method'=>'post',
'id'=>'filter-id',
'enableAjaxValidation'=>true,
)); ?>
<?php
echo $form->dropDownList($find,‘category’,
CHtml::listData(BaseCategory::model()->findAll(array(
'order' => 'name',
'condition'=>'type=:postID',
'params'=>array(':postID'=>1),
)), 'id', 'name'),
array(
'prompt'=>'Select Category',
'ajax'=>array(
'type'=>'POST',
'url'=>CController::createUrl('someurl/searchCategory'),
'update'=>'#'.CHtml::activeId($find,'category2')
),
)
);
?>
<?php
echo $form->dropDownList($find,‘category2’, array(), array(
'prompt'=>'Select Sub Category',
)
);
?>[/font]
[font=“Arial”]I need to place this php code inside pjax content. Working fine when the page refreshed. But when it’s loaded using pjax, this dependent dropdown won’t work.[/font]
question:
[font="Arial"]How to make this dependent dropdown working when its loaded using pjax? What code should I add in:[/font]
[font="Courier New"]$(document)
.on('pjax:success', function() {
})[/font]
[font="Arial"]to make this dependent dropdown works? Is there any script to "reload" this php code, so the dependent dropdown works? Or is there another solution?[/font]