1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    1
    Vote Rating
    0
    bansode.vishal1 is on a distinguished road

      0  

    Default Unanswered: Reason Behind overriding asWidget() in any view

    Unanswered: Reason Behind overriding asWidget() in any view


    What is the reason behind overridding asWidget() method of Composite in each and every view..??
    If I am not implementing it , Then I am not getting the results according to our requirements..

    My Scenario is like,



    public Widget asWidget() {
    Widget widget = uiBinder.createAndBindUi(this);
    ---- do something....
    activityManager.setDisplay(rightCPanel);
    return widget;
    }


    public GXTMyClaimViewImpl(ClientFactory clientFactory) {
    initWidget(uiBinder.createAndBindUi(this));
    this.clientFactory = clientFactory;

    claimEntriesMapper = new ClaimEntryMapper(clientFactory);
    activityManager = new ActivityManager(claimEntriesMapper, clientFactory.getEventBus());
    activityManager.setDisplay(rightCPanel);
    initializeAll();
    }


    if I remove the asWidget() den My Code Dosent work...
    and I hav to do uiBinder.createAndBindUi(this) fr 2 times.....

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Posts
    1,931
    Vote Rating
    55
    Answers
    73
    Colin Alworth is a jewel in the rough Colin Alworth is a jewel in the rough Colin Alworth is a jewel in the rough

      0  

    Default


    If you extend Composite, you *should not* override asWidget() - unpredictable things may happen.

    The IsWidget interface and its asWidget method are mostly useful in cases where you choose not to extend Composite or any other Widget class, but still want to be able to draw the contents on the screen.