Example #1
0
<?php 
$this->endWidget();
?>

</div><!-- form -->
<script>
function updateTree(data)
{
    jQuery.ajax({
        'type':'POST',
        'url':'/scuko/index.php?r=company/getdepartments',
        'cache':false,
        'data':data,
        'success':function(json){
            $("#yw0").("<?php 
CTreeView::saveDataAsHtml($data);
?>
");  
            var arr=JSON.parse(json);
            var i = 0;
            for(i=0;i<arr.length;i++)
            {
                $( "#"+arr[i] ).remove();
            }
        }
    });
    return false;
}
jQuery('body').on('change','#Department_company_id',function(){
    var data = jQuery(this).parents("form").serialize();
    jQuery.ajax({
 public function actionGetDeviceTree()
 {
     if (isset($_POST)) {
         $person_id = $_POST['Device']['person_id'];
         $data = Device::createTreeByPersonID($person_id);
         $html = CTreeView::saveDataAsHtml($data);
         echo $html;
     }
 }