FlexGrid and angular2 directives on edit mode?

Posted by: jbasilio on 31 October 2017, 1:19 am EST

    • Post Options:
    • Link

    Posted 31 October 2017, 1:19 am EST

    Hi:

    Is there a way to use an angular2 directive to control per keystroke input on a FlexGrid cell?

    If not, is there a recommended way to perform per keystroke validation of a cell edit? (i.e. block input if the user tries to put an invalid value into a cell, ex. typing a letter when it’s number only)

    Thanks.

    Jim

  • Posted 31 October 2017, 5:33 pm EST

    Hi Jim,

    For this, you can use the keyDown event for this and check if the target is FlexGrid editor. Please use the following code snippet for the same:

    @ViewChild('flex') flex:wjGrid.FlexGrid;
     ngAfterViewInit(){
       this.flex.hostElement.addEventListener("keydown",(e)=>{
         var sel=this.flex.selection;
         if(this.flex.columns[sel.col].dataType==2){
           //code here
         }
       });
     }
    

    ~Manish

Need extra support?

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

Learn More

Forum Channels