I want to preventing 'select all' of top left cell

Posted by: lost7l on 2 July 2023, 5:35 pm EST

    • Post Options:
    • Link

    Posted 2 July 2023, 5:35 pm EST - Updated 2 July 2023, 5:41 pm EST

    hello, thank you for your help. it really helps me.

    the thing is that i don’t want the top left button of selecting all of clicking event. so i coded like below but it’s not work:

    https://www.grapecity.com/forums/wijmo/flexgrid-top-left-cell-selecting-all-cells

    theGrid.hostElement.addEventListener("mousedown",(e)=>{
    	let ht= theGrid.hitTest(e);
    	if(ht.cellType== wjGrid.CellType.TopLeft){
    		e.preventDefault();
    	}
    });

    plz give me a answer what prevents the selecting all of clicking of top left cell.

    thank you

  • Posted 4 July 2023, 7:44 am EST

    Hi,

    In version ‘5.20181.436’ (specified in the referred forum case), the clicking on selection of all the cells after clicking on the topLeft cell is done in the handler of mouseup event on the cell element. However, in the latest version ‘5.20231.888’, the selection of all the cells is done while handling click event. So, to prevent the selection of all the cells (which happens after clicking the topLeft cell), we may handle the click event on the hostElement of the FlexGrid. We may call preventDefault() method in the handler of this event.

    Please refer to the following code snippet:

    grid.hostElement.addEventListener(
      'click',
      (e) => {
        let ht = grid.hitTest(e.pageX, e.pageY);
        if (ht.cellType === CellType.TopLeft) {
          e.preventDefault();
        }
      },
      true
    );


    Please refer to this sample for reference: https://stackblitz.com/edit/js-h4ndz1

    Regards,

    Manish

Need extra support?

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

Learn More

Forum Channels