JSFiddle - React, Tailwind, and code Playground
by kien16
HTML
<link rel="stylesheet" href="http://cdn.sencha.io/ext-4.1.1-gpl/resources/css/ext-all.css">
JavaScript
/*global Ext:false */
Ext.onReady(function () {
var store = Ext.create('Ext.data.TreeStore', {
fields: [
{name: 'id', type: 'string'},
{name: 'text', type: 'string'},
{name: 'selected', type: 'string'}
],
root: {
expanded: true,
id: '0',
children: [{
text: "detention",
id: '1',
leaf: true
}, {
text: "homework",
id: '2',
expanded: true,
children: [{
id: '3',
text: "book report",
leaf: true
}, {
id: '4',
text: "alegrbra",
leaf: true,
selected: 'true'
}]
}, {
id: '5',
text: "buy lottery tickets",
leaf: true
}]
}
});
Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
width: 200,
height: 200,
store: store,
rootVisible: false,
dockedItems: [{
xtype: 'toolbar',
items: {
text: 'Get Selected nodes',
handler: function(){
var s = this.up('panel').getSelectionModel().getSelection();
if (s[0])
alert(s[0].data.text + ' was selected');
else alert('no selected');
}
}
}],
renderTo: Ext.getBody()
});
});