ExtJS Tree Store

by KevinABoucher

HTML

<link rel="stylesheet" href="http://dev.sencha.com/deploy/ext-4.0.2a/resources/css/ext-all-gray.css">

JavaScript

var store = Ext.create('Ext.data.TreeStore', {
    fields : [{
						name : 'dataIndex',
						type : 'string'
					}, {
						name : 'text',
						type : 'string'
					}, {
						name : 'iconCls',
						type : 'string'
					}, {
						name : 'leaf',
						type : 'boolean',
						defaultValue : false
					}],
    root: {
        text: "Status",
        expanded: true,
        children: [
            {
                text: 'Status',
                leaf: false,
                expanded: true,
                children: [{
                    id : Ext.id(),
                    dataIndex : 'status',
                    text : 'pass',
                    leaf : true
                 }, {
                    id : Ext.id(),
                    dataIndex : 'status',
                    text : 'pass',
                    leaf : true
                 }]
            }
        ]
    }
});

Ext.create('Ext.tree.Panel', {
    id: 'myTree',
    title: 'The Title',
    renderTo: Ext.getBody(),
    height: 300,
    width: 300,
    store: store,
    rootVisible: true
});