[IPython-dev] widget models caching the view
Sat Feb 22 21:40:17 CST 2014
Boarding a plane...
Sent from my iPhone
> On Feb 22, 2014, at 7:19 PM, Jason Grout <firstname.lastname@example.org> wrote:
>> On 2/22/14 8:58 PM, Brian Granger wrote:
>> Hi, sorry, just catching up. I am confused. I don't see how this is
>> even possible. In browsers/DOM it is not possible to have a single DOM
>> element displayed in multiple places on the page. Isn't that what this
>> change tries to do? If it does work, I am guessing that it is broken -
>> surely the events won't fire properly when the view is on the page
>> multiple times.
> But widget views !== dom elements. For my usecase, for example, widget
> views are Three.js objects. And you can certainly have the same
> three.js object in multiple places in the scene graph. For example, I
> want the same geometry object with several different kinds of material.
They way backbone traditionally works - for dom based views - is that the do map one-to-one with those dom elements. They even have a $el attribute that points to the dom element on the page. I understand that not all views use this, but we can't break it for the many views that do use it.
>> Conceptually, I think we *do* want multiple views. Each view maps onto
>> one place in the page where the widget is displayed. Each of those
>> instances needs to be able to handle its own events, etc. For example,
>> only one instance of the view can have focus at a time or accept
>> keyboard input.
>> Am I missing something?
> I thought we were transitioning to having multiple widgets for display
> in different places that were linked together. The "view" is really the
> python instance+backbone model+backbone view. If you want a widget in
> multiple places, create multiple widgets and link them together. The
> model/python instance, then you really probably ought to expose those
> views on the python side with full python view classes.
That transition was not away from multiple views in general. That is and must be fully supported. What we did move away from is a single model with multiple *different* views - like a slider and text box attached to the same model. The word multiple is a bit vague - I use it to mean an instances of the same view class attached to one model but shown in different places on the page - typically different cells
> IPython-dev mailing list
More information about the IPython-dev