We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to disable Keyboard events for TreeGrid?

I'm using Angular Version of TreeGrid. In which, some of the rows are not grouped and when I select a row and apply a keyboard event on such rows I'm getting following error:

How to disable Keyboard events for TreeGrid?

main.0c3400941a0a4d3d3ebf.js:1 TypeError: Cannot read property 'rowIndex' of undefined
    at t.getCollapseExpandRecords (main.0c3400941a0a4d3d3ebf.js:1)
    at t.expandRow (main.0c3400941a0a4d3d3ebf.js:1)
    at t.expandCollapseAll (main.0c3400941a0a4d3d3ebf.js:1)
    at t.expandAll (main.0c3400941a0a4d3d3ebf.js:1)
    at t.treeGridkeyActionHandler (main.0c3400941a0a4d3d3ebf.js:1)
    at HTMLElement.r.keyPressHandler (main.0c3400941a0a4d3d3ebf.js:1)
    at e.invokeTask (polyfills.73b3aeabbeaddf4bfcc2.js:1)
    at Object.onInvokeTask (main.0c3400941a0a4d3d3ebf.js:1)
    at e.invokeTask (polyfills.73b3aeabbeaddf4bfcc2.js:1)
    at t.runTask (polyfills.73b3aeabbeaddf4bfcc2.js:1)

1 Reply

GL Gowri Loganathan Syncfusion Team December 16, 2019 11:44 AM UTC

Hi Shreekumar, 

Thanks for contacting Syncfusion Support. 

Query: How to disable Keyboard events for TreeGrid? 

We have analysed your query at our end and we suggest you to give allowKeyboard:false in the load event to disable the keyboard events for TreeGrid. 

Please refer to the below code snippet:- 
    selector: 'app-container', 
    template: `<ejs-treegrid [dataSource]='data'  (load)='load($event)' [treeColumnIndex]='1' childMapping='subtasks'> 
                    <e-column field='taskID' headerText='Task ID' textAlign='Right' width=70></e-column> 
                    <e-column field='taskName' headerText='Task Name' textAlign='Left' width=200></e-column> 
                    <e-column field='startDate' headerText='Start Date' textAlign='Right' format='yMd' width=90></e-column> 
                    <e-column field='duration' headerText='Duration' textAlign='Right' width=80></e-column> 
.. . .  .  . .. . . . . . . 
       //Define load event// 
        var treegrid=document.getElementsByClassName("e-treegrid")[0].ej2_instances[0]; 

Kindly refer the below sample link and API link: 

Please get back to us ,if you need any further assistance on this. 

Gowri V L. 

Live Chat Icon For mobile
Up arrow icon