/*
 * Ext JS Library 2.2.1
 * Copyright(c) 2006-2009, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext.onReady(function(){
	
	var h = window.screen.height;
	h=h-318;
    var tree = new Ext.tree.ColumnTree({
        width: 974,
        height: h,
        rootVisible:false,
        autoScroll:true,
        title: $bookName,
        /* renderTo: Ext.getBody(), */
		renderTo:'script',

        columns:[{
            header:'目录',
            width:328,
            dataIndex:'index'
        },{
            header:'复习提示',
            width:148,
            dataIndex:'review'
        },{
            header:'记忆进度',
            width:178,
            dataIndex:'process'
        },{
            header:'总题数',
            width:98,
            dataIndex:'total'
        },{
            header:'已做题数',
            width:98,
            dataIndex:'did'
        },{
            header:'已掌握题数',
            width:98,
            dataIndex:'finish'
        }],

        loader: new Ext.tree.TreeLoader({
            url:'/bookStructures/chapterList/'+book_id,
            uiProviders:{
                'col': Ext.tree.ColumnNodeUI
            }
        }),

        root: new Ext.tree.AsyncTreeNode({
            text:'index'
        })
    });
    tree.render();
    
    

    
	tree.expandAll(); 
	
	var tree1 = new Ext.tree.ColumnTree({
        width: 974,
        height: h,
        rootVisible:false,
        autoScroll:true,
        title: 'Example Tasks',
        /* renderTo: Ext.getBody(), */
		renderTo:'markup',
        
        columns:[{
            header:'Task',
            width:330,
            dataIndex:'task'
        },{
            header:'Duration',
            width:100,
            dataIndex:'duration'
        },{
            header:'Assigned To',
            width:100,
            dataIndex:'user'
        }],

        root: new Ext.tree.AsyncTreeNode({
            text:'Duration'
        })
    });
	tree1.expandAll(); 
});
