How to get row data from click event using flexsheet

Posted by: teenu.k on 26 September 2019, 1:04 pm EST

    • Post Options:
    • Link

    Posted 26 September 2019, 1:04 pm EST

    Hi,

    When we click a cell in wijmo how to create click event using flexsheet and I also want the row data of that particular cell in that click event.

    Can Anyone please provide a sample for the same using angular 7.

    Regards,

    Teenu

  • Posted 26 September 2019, 11:33 pm EST

    Hi Teenu,

    Since is an element, you may add a click event just like with any other element:

    <wj-flex-sheet (click)="onClick($event)" #fSheet (initialized)="fSheetInit(fSheet)">
    </wj-flex-sheet>
    

    And to get the current cell and row data, you may use the hitTest method of FlexSheet:

    onClick(e) {
    	let hti = this.fSheet.hitTest(e);
    		if(hti.panel === this.fSheet.cells) {
    			let row = this.fSheet.rows[hti.row], col = this.fSheet.columns[hti.col];
    			let dataItem = row.dataItem;
    			let currentCellData = this.fSheet.getCellValue(row.index, col.index, false);
    	}
      }
    

    You may refer to the sample below:

    https://stackblitz.com/edit/angular-q9gumu

    Regards,

    Ashwin

    API:

Need extra support?

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

Learn More

Forum Channels