当前位置: 代码迷 >> Web前端 >> Ext4.x 树报表控件【Ext.tree.Panel】 Demo
  详细解决方案

Ext4.x 树报表控件【Ext.tree.Panel】 Demo

热度:1142   发布时间:2013-10-18 20:53:13.0
Ext4.x 树表格控件【Ext.tree.Panel】 Demo
Ext.onReady(function(){
	
	Ext.define('User', {
	    extend: 'Ext.data.Model',
	    fields: [
	        {name: 'field',  type: 'string'},
	        {name: 'field_A',   type: 'string'},
	        {name: 'field_B', type: 'string'},
	    ]
	});
	var store = Ext.create('Ext.data.TreeStore', {
		model:"User",
	    root: {
	        expanded: true,
	        children: [
	            { text: "detention",field:"field",field_A:"a",field_B:"b", leaf: true, expanded: true },
	            { text: "homework",field:"field",field_A:"a",field_B:"b", expanded: true, children: [
	                { text: "book report",field:"field",field_A:"a",field_B:"b", leaf: true },
	                { text: "algebra",field:"field",field_A:"a",field_B:"b", leaf: true}
	            ] },
	            { text: "buy lottery tickets",field:"field",field_A:"a",field_B:"b", leaf: true }
	        ]
	    }
	});

	Ext.create('Ext.tree.Panel', {
	    title: 'Simple Tree',
	    //width: 200,
	    //height: 150,
	    store: store,
	    rootVisible: true,
	    
	    columns: {
	        items: [{
	        	xtype:"treecolumn",
	        	text: "columnOne",
	        	dataIndex:"field",
	        },{
                text: "Column A",
                dataIndex: "field_A",
            },{
                text: "Column B",
                dataIndex: "field_B",
            }],
	        defaults: {
	            flex: 1
	        }
	    },
	
	    renderTo: Ext.getBody()
	});
});

?<div class="iteye-blog-content-contain" style="font-size: 14px"></div>

?

  相关解决方案