Hello,
I'm looking to have the selection right-click menu working with glamour-seaside (which is currently not implemented ?). Does somoene already woked on this or have any suggestions about how to do that ?
After looking a bit, maybe it is possible to reuse the scripts used for the actions menu of a presentation (?)
_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi,
As far as I know no right-click menu is implemented in glamour-seaside. The action menus are done using the mb menu jquery plugin, which supports
contextul menus. I think this plugin uses the same html for normal and context menus so it will be possible to reuse the part that builds the menu. However, it may need some extending, as it doesn't support sub-menus.
Regarding the implementation the question is if you would like to support dynamic actions? If you would like this then you have to dymanically load the menus by using ajax. Fortunately the plugin has this feature.
To bind the event to the tree look at _addMarkupAndBindingsForNode from the sglTree widget. Andrei On Fri, Jul 29, 2011 at 5:29 PM, Cyrille Delaunay <[hidden email]> wrote: Hello, _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Reusing mbMenu , I managed to have something starting to to work. In the SGLTreePresenter , when I render a node , I have at one point :
html div script: (self menuScriptWith: html);
contextMenu: self contextMenuId; .... So for now each time I right click on a list item, the context menu appear well (which is already a good improvment for me :)). Now I guess that this menu should appear only when an item is selected. Do you have any idea about how I could dynamically set the menu ? I just looked at your previous answer , maybe I should at _addMarkupAndBindingsForNode ?
2011/7/30 Andrei Vasile Chis <[hidden email]> Hi, _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi,
Determining if a node is selected is easy: this.options.selectedNodes contains a list with the ids of the selected nodes and $node.attr('id') returns the id of the current node.
However I don't see an easy way to display the context menu dynamically only on the selected nodes. This is mainly because the mb-menu plugin doesn't offer this functionality.
If you could send me the code you wrote so far(or commit it) I'll look for a solution. Andrei On Mon, Aug 8, 2011 at 6:21 PM, Cyrille Delaunay <[hidden email]> wrote: Reusing mbMenu , I managed to have something starting to to work. In the SGLTreePresenter , when I render a node , I have at one point : _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Ok thanks, I commited what I did for nor now. The changes are in SGLTreePresenter >> renderNodeTitleFor:on:
One idea I had was to had a 'onClick:' or a 'onSelect:' script (for each list item) that would set or not the context menu. But I'm not sure we can set a tag attribute (here the context menu Id) dynamically
2011/8/9 Andrei Vasile Chis <[hidden email]> Hi, _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Another idea would be to select an item when we right-click on it. It seems that this is what is doing the morphic rendering: when I right-click on a list item , it select it. I guess this would be easier to implement (add the same actions/scripts for the right-click than for the left click)
2011/8/9 Cyrille Delaunay <[hidden email]> Ok thanks, I commited what I did for nor now. The changes are in SGLTreePresenter >> renderNodeTitleFor:on: _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi,
It is not necessarily simpler because when you deal with lists allowing multiple selection, you should explicitly not select the node when right clicking on an existing multiple selection. Cheers, Doru On 9 Aug 2011, at 11:37, Cyrille Delaunay wrote: > Another idea would be to select an item when we right-click on it. It seems that this is what is doing the morphic rendering: when I right-click on a list item , it select it. I guess this would be easier to implement (add the same actions/scripts for the right-click than for the left click) > > 2011/8/9 Cyrille Delaunay <[hidden email]> > Ok thanks, I commited what I did for nor now. The changes are in SGLTreePresenter >> renderNodeTitleFor:on: > One idea I had was to had a 'onClick:' or a 'onSelect:' script (for each list item) that would set or not the context menu. But I'm not sure we can set a tag attribute (here the context menu Id) dynamically > > > 2011/8/9 Andrei Vasile Chis <[hidden email]> > Hi, > > Determining if a node is selected is easy: this.options.selectedNodes contains a list > with the ids of the selected nodes and $node.attr('id') returns the id of the current node. > > However I don't see an easy way to display the context menu dynamically only on > the selected nodes. This is mainly because the mb-menu plugin doesn't offer this > functionality. > > If you could send me the code you wrote so far(or commit it) I'll look for a solution. > > > Andrei > > > On Mon, Aug 8, 2011 at 6:21 PM, Cyrille Delaunay <[hidden email]> wrote: > Reusing mbMenu , I managed to have something starting to to work. In the SGLTreePresenter , when I render a node , I have at one point : > > html div > script: (self menuScriptWith: html); > contextMenu: self contextMenuId; > .... > > So for now each time I right click on a list item, the context menu appear well (which is already a good improvment for me :)). > Now I guess that this menu should appear only when an item is selected. Do you have any idea about how I could dynamically set the menu ? I just looked at your previous answer , maybe I should at _addMarkupAndBindingsForNode ? > > 2011/7/30 Andrei Vasile Chis <[hidden email]> > Hi, > > As far as I know no right-click menu is implemented in glamour-seaside. > > The action menus are done using the mb menu jquery plugin, which supports > contextul menus. I think this plugin uses the same html for normal and context > menus so it will be possible to reuse the part that builds the menu. > However, it may need some extending, as it doesn't support sub-menus. > > Regarding the implementation the question is if you would like to support > dynamic actions? If you would like this then you have to dymanically load > the menus by using ajax. Fortunately the plugin has this feature. > To bind the event to the tree look at _addMarkupAndBindingsForNode from > the sglTree widget. > > Andrei > > > On Fri, Jul 29, 2011 at 5:29 PM, Cyrille Delaunay <[hidden email]> wrote: > Hello, > > I'm looking to have the selection right-click menu working with glamour-seaside (which is currently not implemented ?). > Does somoene already woked on this or have any suggestions about how to do that ? > After looking a bit, maybe it is possible to reuse the scripts used for the actions menu of a presentation (?) > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- www.tudorgirba.com "It's not what we do that matters most, it's how we do it." _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
In reply to this post by cdelaunay
Hi,
After looking through the code of the mb-menu plugin it turns out there is a very simple way to suppress the menu from opening (add the attribute menu="empty"). To only display context menus for selected nodes add in _addMarkupAndBindingsForNode
after $nodeContent.bind("click", function(event) { that._handleSelectionClickEvent(event, $node);
return false; }); the lines: $nodeContent.bind("contextmenu", function(event) { if ($nodeContent.attr("cmenu")) {
if ($.inArray($node.attr("id"), that.options.selectedNodes) == -1) { $nodeContent.attr("menu", "empty"); } else { $nodeContent.removeAttr("menu");
} } }); There is only one small bug: if the tree doesn't have a context menu it will display a small black line. To avoid it you should only add the script for creating the
context menu if the tree has such a menu. Regarding the second ideea I don't think it can be simpler than this :). However if that is the proper behaviour let me know and I will have a look.
Andrei On Tue, Aug 9, 2011 at 11:26 AM, Cyrille Delaunay <[hidden email]> wrote: Ok thanks, I commited what I did for nor now. The changes are in SGLTreePresenter >> renderNodeTitleFor:on: _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Thanks a lot , this looks indeed simple :)
I will check that tomorow , thank you
2011/8/9 Andrei Vasile Chis <[hidden email]> Hi, _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
It works perfectly :) I integrated the changes
2011/8/9 Cyrille Delaunay <[hidden email]> Thanks a lot , this looks indeed simple :) _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Free forum by Nabble | Edit this page |