Hi Miron, see my comments below.
On Monday 14 September 2009 Miron Brezuleanu wrote: > The solution was to add a column with an 'actions' link to each row > (clicking the link should display the context menu). Side question: is > it possible to embed widgets such as buttons in the table? Couldn't > find a cell renderer to do that, so I assume no. You assumed right. The table widget is not capable of showing embedded widgets inside the cells. There are plans for a new implementation of a data grid (=table) which will support this feature, but this implementation is still in a very early phase. > To show the context menu programatically I used the code from > Widget._onContextMenuOpen: > > var menu = this.getContextMenu(); > menu.placeToMouse(e); > menu.show(); > > from a cellclick event. It didn't work (menu not showing at all, menu > showing only on the first click) until I moved this code into a > Timer.once call. > > Is there a better way to do this? No, you have to make this asynchronous to let the browser do the background jobs before the menu is opened. In this scenario the timer gives back the control to browser to do his open background jobs. After these are done the callback of the timer is called. > Now for my main question: it's not obvious to me why I need a > Timer.once call here. I tend to use Timer.once as a kind of 'yield' > operation in cooperative multitasking, and I assume Qooxdoo needed to > do some processing in the background before running the code that > displays the menu (I also create the context menu in the cellclick > handler, as it depends on the row). Actually it's the browser which needs some time to process his stuff. After these tasks are done the control is given back to qooxdoo. The routines in qooxdoo then push the rendering of the menu. > Is there a heuristic that I can use to determine when to use > Timer.once? (this time it was a gut feeling, I'd like something more > reliable). Not a 100% reliable one. There are scenarios in which the browser needs some time to e.g. update the DOM and if that's the case a timer is a effective kind of "pausing" the execution of the own script and give the control temporarily back to the browser. I hope my explanations have lighten up things a little bit. cheers, Alex ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
