I've been known to use code like this:

     calendarsController.bind('selection[0]', entriesList, 'model', {
       converter: function(calendar) {
         if (calendar == null)
           return null;
         return new load_calendar(calendar.getId());
       }

I.e. use the databinding converter to trigger an Ajax request to the 
server. This seemed preferable to me, because

      calendarsController.getSelection().addListener('change', ...

will not work if the selection array has a whole is replaced (and you 
end up needing to do things like these:

     var selection = this.tree.getController().getSelection();
     selection.splice(0, selection.length, newSelectedItem);

to replace a selection in one step.

(If I'm missing something here with regards to changing a selection 
array I'd love to know).

The problem with the code above is that the converter *always* triggers 
twice. This is because of the code in MSelection.js:

       ...
       // use splice to ensure a correct change event [BUG #4728]
       selection.splice.apply(selection, spliceArgs).dispose();

       // fire the change event manually
       this.fireDataEvent("changeSelection", this.getSelection());

I.e., the binding first triggers via the "no-op" splice, then is 
triggered again manually.

Now this is inacceptable in my case where data is loaded from the 
server, but I image there are other cases where you wouldn't want this 
to happen, and in general it doesn't seem like good design.

Any thoughts? Can this be changed?

Michael

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to