Call autoSizeColumn once flexgrid render complete

Posted by: 1728884346 on 13 November 2018, 1:45 am EST

    • Post Options:
    • Link

    Posted 13 November 2018, 1:45 am EST

    sorry, for what i’m see, may i check with you, is autoSizeColumn will cause little performance issue if Flexgrid has lots record? any idea to avoid?

    https://www.grapecity.com/en/forums/mvc-edition/call-autosizecolumn-once-f

  • Posted 13 November 2018, 1:46 am EST

    because previous one post has been mark as answered, so i create this new one.

  • Posted 14 November 2018, 3:20 am EST

    is possible to autoSize column include footer row?

  • Posted 14 November 2018, 3:26 am EST

    Hi,

    Yes, there will be performance issues if a large number of cells are present, This is because it will calculate every cell’s width/height.

    There are some performance improvements which you can make by avoiding some common pitfalls.

    1. Instead of calling autoSizeColumns(which auto size every column), use autoSizeColumn to resize only the columns which need resizing.

    Identify which are the columns that actually need resizing. Sometimes columns with types like ‘Date’, ‘Checkbox’… are used which rarely needs resizing. A formatted date column would have the same text width throughout the rows. So you can calculate the width once and apply it.

    1. Use deferUpdate method. The deferUpdate method ensures that FlexGrid will not refresh until all its included operations have been applied. So your new updateLayout method would look something like this:
    
        function updateLayout(s, e) {
            if (isLoad) {
                isLoad = false;
                s.deferUpdate(function(){
                            s.autoSizeColumn(1);
                            s.autoSizeColumn(3);
                            s.autoSizeColumn(4);
                });
            }
        }
    
    
    1. If you are using autoSizeXXXX methods on a grid with a large number of rows, try implementing Paging in your grid.

    https://demos.componentone.com/ASPNET/MVCExplorer/FlexGrid/Paging

    Let me know if you face more performance issues.

  • Posted 17 November 2018, 11:05 am EST

    thank you very much, i will try it.

Need extra support?

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

Learn More

Forum Channels