[CLOSED] What replaces the Javascript call "doLayout"

  1. #1

    [CLOSED] What replaces the Javascript call "doLayout"

    Hello,
    Do you know what replaces the Javascript call "doLayout" in ext.net 4? It seems that it no longer exists in the ext-all.js file. I am calling it in an AfterRender handler...

     .Listeners (
            l =>
            {
                if ( Model.IsError )
                {
                    l.AfterRender.Handler = "Core.ErrorWindow( '" 
    											+ Model.ErrorMessage.DetailedErrorMessage 
    												+ "', '" 
    													+ Model.ErrorMessage.FriendlyErrorMessage + "' ); ".Clean();
                }
                else
                {
                    l.AfterRender.Handler = "this.doLayout(); ";
                }
                l.AfterRender.Delay = 1;
            }
        )
    Thanks.
    Last edited by fabricio.murta; Apr 20, 2016 at 2:06 PM.
  2. #2
    Hello @edip!

    Can you feed more information on the question? I'm not certain about some things:
    - what's the context? the actual component the listener is being fired from
    - what's the version you are checking against? the doLayout() might be a private method and they might be moved away without notice nor assumed breaking change (as private methods are not to be relied upon anyway) or just hid (moved from "namespace"/class, for example).

    Hope to hear back from you soon so we can provide a better advice.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi Fabricio,
    It is an Ext.Net.Container that contains panels which contain menu items. The menu items do not get refreshed properly if "doLayout" is not called. The "doLayout" function seems to be included in Version 3.3 and earlier of the ext-all.js library...

        doLayout: function() {
            this.updateLayout();
            return this;
        },
    I am migrating from Version 2.5.2 of Ext.Net. Is there something else I should be calling to make sure all of the menu items are rendered?...



    @(
        X.Container ( )
        .AutoScroll ( true )
        .Items (
            Model.LeftSideMenuExtNet
        )
        .Listeners (
            l =>
            {
                if ( Model.IsError )
                {
                    l.AfterRender.Handler = "Core.ErrorWindow( '" 
    							+ Model.ErrorMessage.DetailedErrorMessage 
    								+ "', '" 
    									+ Model.ErrorMessage.FriendlyErrorMessage + "' ); ".Clean();
                }
                else
                {
                    // l.AfterRender.Handler = "this.doLayout(); ";
                }
                l.AfterRender.Delay = 1;
            }
        )
    
    )

    Click image for larger version. 

Name:	Menu.jpg 
Views:	68 
Size:	18.7 KB 
ID:	24555
    Last edited by edip; Apr 11, 2016 at 6:38 PM.
  4. #4
    Hello @edip!

    Thanks for sharing additional info on your issue.

    In short, doLayout() is no longer on Ext.NET since 3.x. This is because components are meant to be able to redraw dynamically as they are updated.

    For example, while setting width/height on an already drawn component, you should do it via component's component.setHeigh() or component.setWidth().

    Sometimes Ext.NET would do the job for you. That is, if you do from C# side a Component.Width = i and it calls the JavaScript equivalent setter method accordingly when it comes back to client side (building/refreshing the client page).

    But as you stated, it is not working at all for you in your view. There's a thread on the underlying framework's forum (ExtJS) that I used as base for the reply above, you may want to read it: URL="https://www.sencha.com/forum/showthread.php?150562"]doLayout?[/URL]

    And also, maybe what you need in your case is element.redraw() as suggested in the example. But maybe it is not the case, and something even better probably is there to allow to delay-less fit the contents of the page.

    As you show your code, seems during load the user may notice the contents refitting the containers, is this the case? Maybe with the new implementation in can be done in such a way they are shown and fixed on spot.

    That said, maybe you can share a full, yet simplified, example of your view emphasizing where it does not fit; and then we could provide you a proper manner of setting it up to fit the view correctly?
    Fabrício Murta
    Developer & Support Expert
  5. #5
    It seems that "doLayout" has been replaced by "updateLayout".

Similar Threads

  1. Replies: 8
    Last Post: Jan 31, 2015, 6:08 AM
  2. [CLOSED] HtmlEditor.Call("append", "xxx") does not work
    By hdsoso in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Feb 17, 2014, 11:36 PM
  3. Replies: 1
    Last Post: Jan 08, 2014, 6:05 AM
  4. Replies: 3
    Last Post: May 14, 2013, 12:34 AM
  5. Replies: 2
    Last Post: May 05, 2013, 3:52 AM

Posting Permissions