JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://dev.sencha.com/deploy/ext-4.0.2a/resources/css/ext-all.css">
<input type="button" onclick="elegir()" value="tocame">
JavaScript
var menuOpcionesUsuario = new Ext.menu.Menu( {
id: 'menuOpcionesUsuario',
//title: 'opciones',
margin: '0 0 10 0',
plain: true, //elimina separador
//defaults:{
// iconAlign: 'top' // <--- we change the icon position
//},
data:{
idSubmenu : 0
},
floating: true,
listeners: {
render: function(ventana) {
},
beforeshow: function(ventana) {
},
beforehide: function(ventana){
}
},
items: [
{
text: 'Cambiar de Reparticion',
iconCls:'menu_house_1',
handler: function(){
ventanaCambiarRepart.show();
}
}]
});
var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{ text: "detention", id:'item_1', cls:'doc_3', leaf: true },
{ text: "homework", id:'item_2', expanded: true, children: [
{ text: "book report", id:'item_3', checked:true, leaf: true },
{ text: "alegrbra", id:'item_4', leaf: true}
] },
{ text: "buy lottery tickets", id:'item_5', leaf: true }
]
}
});
Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
id:'tree-panel',
width: 200,
height: 200,
store: store,
autoScroll: true,
//rootVisible: false,
renderTo: Ext.getBody(),
listeners: {
render: function() {
Ext.getBody().on("contextmenu", Ext.emptyFn, null, {preventDefault: true});
},
itemcontextmenu : function( grid, record, item, index, event){
x = event.browserEvent.clientX;
y = event.browserEvent.clientY;
console.log(record,item)
menuOpcionesUsuario.showAt([x, y]);
}
}
});
var tree = Ext.getCmp('tree-panel');
tree.getSelectionModel().select(3);
//console.log(Ext.getCmp('item_3'))
function elegir(){
var TreeNodeId =...