Browser or container resize

Posted by: jkainth on 19 March 2018, 8:12 am EST

    • Post Options:
    • Link

    Posted 19 March 2018, 8:12 am EST

    Not sure if this is bug or not.

    But if the container the views is in or the broswer resizes. The spread.views grid layout does not resize to fit its container even though it’s width/height is set to 100% of parent.

    So question is:

    1. is this a bug? missing feature?
    2. if my app has to manually do this; which method should i call? dataview.invalidate or refresh(area)?
    3. if it is invalidate i call, should i be calling it with a true or false for rebuildDOMTree variable?

      i am guessing it is faster if i say don’t rebuildDOMTree, but if thats the case what would not work or break?

    thanks

    J

  • Posted 19 March 2018, 8:13 pm EST

    Hello,

    I tested it with rebuildDomTree option and it seems to be working fine. I used the code as follows to reduce the container div’s height and width and found that Spread.Views adjusts accordingly:

    
       var dataView;
            function Resize()
            {
                document.getElementById("container").style.height = 600 + "px";
                document.getElementById("container").style.width = 400 + "px";
                dataView.invalidate(true);
            }
    
    

    Please refer to the attached sample application.

    Thanks,

    Deepak SharmaSpreadViewInContainerCheck.zip

  • Posted 20 March 2018, 12:30 am EST

    Hi

    yes it works, but id like to know more details:

    1. is that the only way? so Spread.views does not natively respect container resizes

    2. dataView.invalidate(true) vs dataView.invalidate(false); i tested both and they both work.

      What is the difference - and for my case of just resizing, which one should i be using? rebuildDomTree seems like an expensive operation?

  • Posted 21 March 2018, 1:46 am EST

    Hello,

    This is correct, we need to the refresh the layout in order to get Dataview adjusted to height/width.

    DataView.Invalidate() method’s ‘rebuildDOMTree’ parameter decides whether to replace the old DOM tree with new one(when set to true) or update the old DOM tree container and refreshes each layout area(when set to true). So updating the DOM and refreshing will be quicker than to rebuilding the whole DOM tree.

    I hope it clarifies.

    Thanks,

    Deepak Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels