Hey,
> 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).
Thats the way to go here. But I would suggest to use the splice in any case due 
to performance. Creating a new array needs time and if your simply replace the 
array, make sure you dispose the one you override to prevent memory leaks. So 
using splice is suggested way here but the other is possible as well.

> 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.
As this is not by design, I can simply agree with you.

> Any thoughts? Can this be changed?
I need to check that in detail but my first impression is that it should be 
changed. Could you open up a bug report for that?

Regards,
Martin
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to