Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    What is a proper way of showing/hiding/creating/destroying components?

    Hi,

    I have a question to Isomorphic developers regarding usage of SmartGWT components. I do not expect any kind of source code - just some clarification on the topic.

    Lets assume following case:
    - we have a set of 10 different views specified for the Application
    - on each view we intermix GWT and SmartGWT components
    - we want to load only necessary views (i.e. first we load the Home view and later on we load other views when needed)
    - we want to make it efficient (avoiding expensive RECREATION of components)
    - there is one main container but each view can have different layout (lets just assume that we have one GWT2.0 DockLayoutPanel and we wish to inject different 'layouts' into this container)

    So, how we should achieve this?
    1. Should we create GUI components once (upon first visit of a view), and then show/hide them? (this would allow max efficiency)
    2. Should we create / destroy ("clear();") GUI components every time we load different view? (more expensive, but I think this would help us handling some DOM errors that came up during development)

    Thanks for some thoughts. In our project we want to stick to the GWT2.0 wherever possible (especially when it comes to the layout), but we wish to add some fancy features of SmartGWT. We had some troubles with it (those nasty "Object required" and "xxx is null or not an object" errors), so now we want to sit down and find the proper way of integrating those two frameworks.

    #2
    In SmartGWT there are 3 stages in the widget lifecycle with pairs of methods:

    1. create() / destroy() : creates/destroys the underlying JavaScript object representing the widget and all of it's state

    2. draw() / clear() : creates/destroys the temporary DOM representation of a widget

    3. show() / hide() : makes visible or hides the DOM representation

    The draw() / clear() cycle is the best way to manage a large number of complex screens, since clear()ing a component has no effect on it's state, so there's nothing tricky to manage in terms of recreating the same DOM later. This simplicity is one of the reasons why, as we tell you in the FAQ, you don't want to intermix GWT and SmartGWT widgets unless you absolutely have to - and it's clear that you don't.

    Comment

    Working...
    X