Disable user dragfill in column direction

Posted by: namratha.bejgam on 7 October 2021, 4:54 pm EST

  • Posted 7 October 2021, 4:54 pm EST - Updated 11 January 2024, 5:40 am EST

    Hi,

    Is there any way we can restrict the user drag and fill functionality in SpreadJS only to row direction (i.e., disable it in column direction)? Looks like there’s no such apt option available currently.

    Thanks

  • Posted 7 October 2021, 4:58 pm EST - Updated 29 September 2022, 5:01 am EST

    [quote=“namratha.bejgam”]

    Hi,

    Is there any way we can restrict the user drag and fill functionality in SpreadJS only to row direction (i.e., disable it in column direction)? Looks like there’s no such apt option available currently.

    Thanks

    [/quote]

    Here’s the image for reference

  • Posted 10 October 2021, 6:33 pm EST

    Hi,

    For this, You may use the DragFillBlock event and cancel it if the direction is left or right. Please refer to the following code snippet and let me know if you face any issues.

    
      sheet.bind(GC.Spread.Sheets.Events.DragFillBlock, (e, args) => {
        if (
          args.fillDirection === GC.Spread.Sheets.Fill.FillDirection.right ||
          args.fillDirection === GC.Spread.Sheets.Fill.FillDirection.left
        )
          args.cancel = true;
      });
    
    

    DragFillBlock: https://www.grapecity.com/spreadjs/docs/v14/online/SpreadJS~GC.Spread.Sheets.Events~DragFillBlock_EV.html

    Regards

    Avinash

  • Posted 11 October 2021, 6:07 pm EST

    The dragfill part works like a charm, thanks.

    But how do we handle the same for Copy-Paste?

  • Posted 12 October 2021, 4:56 pm EST

    Hi,

    Similarly, you could handle ClipboardPasting event and cancel the action if the range has more than one column. Please refer to the following code snippet and let me know if you face any issues.

    
     sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, (e, args) => {
        if (args.cellRange.colCount > 1) args.cancel = true;
      });
    
    

    ClipboardPasting: https://www.grapecity.com/spreadjs/docs/v14/online/SpreadJS~GC.Spread.Sheets.Events~ClipboardPasting_EV.html

    Regards

    Avinash

Need extra support?

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

Learn More

Forum Channels