Set the horizontal scroll positon to left

Posted by: johina.olla on 1 August 2022, 9:37 pm EST

  • Posted 1 August 2022, 9:37 pm EST - Updated 3 October 2022, 12:09 am EST

    We are using spreadJS 14, and providing a functionality of “Filter” by which user can show hide the sheet column by check/uncheck the filter as you can see in screen shot image 1. Currently all columns are visible also the horizontal scroll position is left.

    But after we applied the filter then the respective column gets hide and horizontal scroll position also changes it get sifted to right as you can in 2nd and 3rd screen shot depend upon how many column we hide.

    Please suggest how do we fix scroll position to left after the column is hidden also moveable to right as well and get back to original position if not filter is applied.

    Thanks & Regards

    Johina Olla

  • Posted 1 August 2022, 10:10 pm EST

    Code used for this is :

    sheet.options.isProtected = false;

    sheet.suspendPaint();

    for (let i = 0; i < defColList.length; i++) {

    sheet.setColumnVisible(defColList[i].index, defColList[i].ischecked);

    if (defColList[i].indexOfDefColName != null)

    sheet.setColumnVisible(defColList[i].indexOfDefColName, defColList[i].ischecked);

    }

    sheet.options.isProtected = true;

    sheet.resumePaint();

  • Posted 2 August 2022, 3:49 pm EST - Updated 3 October 2022, 12:09 am EST

    Hi Johina,

    You need to enable the precision scrolling by pixel. By default, the pixel scrolling is not enabled and the default scrolling is by rows and columns. You can enable the pixel scrolling by using

    spread.options.scrollByPixel = true;
    

    For example, you can refer to the following sample that I have created for you: https://jscodemine.grapecity.com/share/TDayR_SQN0SLDbRvIRUqRg/

    API Docs:

    Scroll By Pixel: https://www.grapecity.com/spreadjs/docs/latest/online/scroll-by-pixel.html

    Pixel Scrolling Demo: https://www.grapecity.com/spreadjs/demos/features/workbook/scrollbars/pixel-scrolling

    Workbook Options: https://www.grapecity.com/spreadjs/docs/latest/online/SpreadJS~GC.Spread.Sheets.Workbook~options.html

    I hope this resolves your issue. Please let us know if the issue still persists for you or we are missing any step. We would be happy to help you.

    Regards

    Ankit

Need extra support?

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

Learn More

Forum Channels