Topic: MifTree and MifMenu integration
moro,
Can you post an example of how to show MifMenu depending on a clicked MifTree node?
Thank you
You are not logged in. Please login or register.
Pages 1
moro,
Can you post an example of how to show MifMenu depending on a clicked MifTree node?
Thank you
Note: i made small hack in Mif.Tree::initEvents:
mousedown: function(){this.fireEvent('mousedown'); return false;}.bind(this),Mif.Menu will be rewriten, now we have only this not easy way to attach and manipulate with menu.
var testMenu=new Mif.Menu({
list: {
items: [
{
name: 'alert toggle state',
onAction: function(){
alert(this.menu.treeItem.isOpen() ? 'open' : 'close');
}
},
{
name: 'open',
onAction: function(){
alert('open');
}
}
]
}
});
tree.container.addEvent('contextmenu', function(event){
var node=tree.mouse.node;
if(!node) return;
testMenu.show(event);
testMenu.treeItem=tree.mouse.node;
var item1=testMenu.list.items[1];
item1.options.name=node.name;
var container=item1.container;
item1.draw();
item1.container.replaces(container);
return false;
});
tree.addEvent('mousedown', function(){
testMenu.hide();
});I've just download MifMenu trunk and seems that is incompatible with Mootools 1.2 ...
Firebug return me : "this.parent is not a function" on line 171 ...
this.parent($merge(this.options, {styles: {position: 'absolute'}}), 'mifmenu');
mootools 1.2? try 1.2.1, but it should work, mb u not include some files
this demo work in ff2
I'm running Mootools 1.2.1
I've download Mif.Menu from your builder
all components? u include Mif.Container?
u download this demo archive, it's work?
I'm running Apple Mac OS X 10.5.5 with latest Firefox ...
I can't open context menu ... neither right or left click doens't works ...
On you must do CTRL + Left click to fire contextmenu event ...
I've just discovered it !...
On windows it works with right button
Do this demo use mootools 1.2.1 ?
i'm install ff3.0.4 pc, works for me.
alt+left click - temporal fix for opera, because it's don't support contextmenu event
i don't know how contextmenu event should work on mac os
Hi moro,
I've read that Mif.Menu is going to be rewritten, is that already done ? Or is the way of integrating MifTree and MifMenu you provided in 2008 still valid ?
Thanks in advance,
Jan
Mif.Menu under development. If you use old(because new not exist yet) menu version all old code will work, because nothing changed :-)
To add/delete nodes with Mif.Menu only do the following:
var testMenu=new Mif.Menu({
list: {
items: [
{
name: 'Add node here',
onAction: function() {
var current = this.menu.treeItem;
if(!current) return;
tree.add({
property: {
name: "testnode"
}
}, current, 'inside');
}
},
{
name: 'Drop this node',
onAction: function() {
var current = this.menu.treeItem;
if (!current) return;
current.remove();
}
}
]
}
});
tree.container.addEvent('contextmenu', function(event){
var node=tree.mouse.node;
if(!node) return;
testMenu.show(event);
testMenu.treeItem=tree.mouse.node;
return false;
});Hello, I have a problem with the integration
I have this definition of a menu :
var testMenu = new Mif.Menu().load([
{
name: 'open',
action: function()
{
var current = this.treeItem;
if(!current) return;
alert('open : ' + current.id);
}
},
{
name: 'remove',
disabled: true
},
{
name: 'exit',
id: 'exit'
}
]);With this event on the tree (otree) :
otree.container.addEvent("contextmenu", function(event)
{
var node = otree.mouse.node;
if(!node) return;
testMenu.treeItem = node;
testMenu.show(event);
return false;
});My problem is when I do a rigth-click nearby the label/name of the tree, the menu is visible, if I click on the label/name, nothing to do
The code is ok with a old version of tree+menu, but with the last version, I have this problem.
Hello, I have a problem with the integration
...
My problem is when I do a rigth-click nearby the label/name of the tree, the menu is visible, if I click on the label/name, nothing to doThe code is ok with a old version of tree+menu, but with the last version, I have this problem.
works for me http://mifjs.net/misc/tree_menu/
Thanks, I have redo my code, and now it's ok.
i don't know why with all javascript in "source" folder .... I have the error, with only one "js" no problem.
Posts [ 19 ]
Pages 1
Powered by PunBB