I am sorry if I try to do something that pyjamas is not supposed to
support. I hope you understand that for someone who has a codebase a
gradual transition would be nice (if possible). I will search for the 50
lines, so far I have either overlooked that example. I will next go over
the mailing list.
Would I more likely not run into problems if I never remove the element
that pyjamas has 'created'?
Just to be clear: I do prefer not to mix managing the same part of the
DOM tree with jQuery *and* Pyjamas. What I thought of doing is:
1) initiate the web page from web2py with an element with a specific ID
'abc' that gets replaced by a jQuery call.
2) the 'abc' element has somewhere a child element in its tree with ID 'xyz'
3) have the jQuery startup function initiate pyjamas to replace the xyz
element, everything within that is managed by pyjamas
4) if a jQuery managed button is pressed, it replaces element with ID
abc. I want shut down pyjamas properly before doing so
and afterwards reinitiate pyjamas to fill out element xyz again.
Apart from the proper shutdown in 4) I think this is working.
However I will look into not doing the handling of button presses with
jQuery essentially making element 'abc' and 'xyz' the same with a more
complete pyjamas program. That would mean I only start pyjamas once and
it should handle any further interaction under the element abc/xyz.
WRT the RootPanel question: I provided RootPanel.get() with a string,
But I thought RootPanel has no get method, and that causes the error.
On 2011-12-12 19:22, Luke Kenneth Casson Leighton wrote:
On Mon, Dec 12, 2011 at 1:44 PM, Anthon van der Neut<[email protected]> wrote:
I am not sure if the openWindowClosed event should be triggered, since I do
not close anywindows. I just replace a div (which includes the element with
the ID I later replace from the python main() function.
ok then you want RootPanel.get(id_to_use) - see dynamictable as an example.
But then I need the patch I supplied earlier because
RootPanel(id_to_use), caches the result and that gets invalidated by the
reinsertion of DOM elements by jQuery.
mhrhhmm... ok could you put together an example somewhere? oh wait,
hang on: you're *reinserting* DOM elements using jquery? yes, that's
pretty much guaranteed to get you into trouble, all round.
you can't do that: an element that is "managed" by a pyjamas object
has to remain "managed". you can manipulate sub-DOM (i.e. child DOM
elements) but you *cannot* touch anything that is referred to via a
"self.element".
not unless you want to get into a mess, that is.
there's a way round that - it needs about 50 lines of code to be
written, that's all, and i've described several times what's needed.
Even if the onWindowsClosed would
trigger, the original code does not empty the rootPanels 'cache'.
BTW RootPanel.get(id_to_use) throws an error.
that has to be a string, obviously, named after the id of the div
that you want objects to be attached to.