Announcement

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

    How to observe view load in SmartGWT ViewLoader?

    Hi,

    I can't find a way to attach to the on View Load event for ViewLoader in SmartGWT.
    The javadoc comments for viewLoaded() method is unclear as well. Can you provide a sample on how to observe on View Load event in SmartGWT.

    Code:
    ViewLoader pageLoader = new ViewLoader();
    pageLoader.setViewURL(myURL);
    pageLoader.viewLoaded(pageLoader);
    
    Canvas pageTop = new Canvas(pageLoader.getJsObj());
    
    -- Canvas cnButton = Canvas.getById("Button1"); //return null - the button is defined inside the loaded page but is not available in this line - view is not loaded yet
    
    final Window winModal = new Window();
    ....
    winModal.addItem(pageTop);
    winModal.show();
    Comments to the code:
    - Unclear why to call pageLoader.viewLoaded(pageLoader); - it supposed to be called on view load asynchronously not directly by my code??? But without it it doesn't work
    - I can't access cnButton that is inside the page

    I saw a couple references on Class.observe() from SmartClient, but it's not available in SmartGWT API

    Thanks
Working...
X