{% extends "data_list.html" %}
{% block headjs%}
{% endblock %}
{% load i18n %}
{% block addjs %}
    $(function(){
    	

        $(".div_inline").append($("#id_show_dept_data"));
		$(".div_inline").addClass("showDeptTree");

		$("#id_show_dept_data").show();
		$("#id_show_dept_data").find("#id_show_dept_tree").css({height:$(".dt_bdiv").height()+42});
        
        $("#id_spn_refresh").click(function(){
            $.ajax({ 
            	type: "POST",
            	url:"{{dbapp_url}}personnel/Department/choice_data_widget?depttree=True",
            	dataType:"html",
            	success:function(json){ 
                    data=json
                    $("#id_show_dept_tree").html("");
                    $("#id_show_dept_tree").html(data);
            	}
            });	
            
        });
        $("#id_spn_refresh").click();

        after_init = function(){
            $("#id_show_dept_data").hide();
            $(".div_ListAndFilter").css("width","100%")
        };
        after_close=function(){
           $("#id_show_dept_data").show();
           $(".div_ListAndFilter").css("width","70%")
        };
    })
//点击树形空间,左边表格刷新    
    function reflash_child_dept_list(event, treeId, treeNode){
			var parent_id = treeNode.id;
			var strwhere=[];
			strwhere.push("parent__id__exact="+parent_id);  
			var $grid = $("#id_datalist");
			var datalist=$grid.get(0);
			datalist.g.init_query=strwhere;
			datalist.g.load_data();
	}
    
{% endblock %}
{% load personnel_tags %}

{% block addition_content %} 
		<div id='id_show_dept_data' class="div_box floatR" style="width:25%; margin-right:5px !important; margin-left:0px !important; display:none;">
			<h1 align="right">&nbsp;<a id="id_spn_refresh" href="javascript:void(0)">{% trans '刷新' %}</a ></h1>
			<div id="id_show_dept_tree" style="overflow: auto;  width:100%">
				<!--height: 323px;height: 302px\9;_height: 326px;-->
				<ul id="id_show_dept_tree" ></ul>
				</div><div class='clear'>
			</div>
		</div>
{% endblock %}
