/**
 * blog and plan 的左侧树形列表参数 
 * 
 * @link      http://www.u-bo.com
 * @copyright 南京友博网络科技有限公司 
 * @license   http://www.u-bo.com/license/ 
 * 
 * @author HuLimin http://blog.u-bo.com
 * @since 0.1
 */

var setting = {
    async: {
        enable: true,
        url: getTreeDataUrl,
        type:'get'
    },
    data: {
        simpleData: {
            enable: true,
            idKey: "cat_id",
            pIdKey: "parent_id"
        }
    },
    view: {
        showIcon: false,
        selectedMulti: false,
        fontCss: {
            color: "#005bb8"
        }
    },
    callback: {
        onClick: zTreeOnClick
    },
    editable: true // 开启可编辑
}
$(document).ready(function () {
    $.fn.zTree.init($("#tree"), setting);
});

function zTreeOnClick(event, treeId, treeNode) {
    var childIds = treeNode.child_ids;
    var catId = treeNode.cat_id;
    var url = $("#add-btn").data('url');
        $("#add-btn").data('url', url + "&cat_id=" + catId);
    //console.log($("#add-btn").data('url'));
    parent.document.getElementById("main_content").src = iframeDataUrl + "&child_ids=" + childIds;
}


