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

GridComponent scroll issue

I’m facing an issue using the Syncfusion examples of the GridComponent of React, if added more columns to the table, the horizontal the scrolling appears, which is fine the problem is after scrolling the table to the right, when I try to edit a column the focus comes back to the initial position of the table.
Do you have any suggestions to fix this behaviour?

Attachment: gridcomponent_example_b35d43ea.7z

3 Replies

BS Balaji Sekar Syncfusion Team August 21, 2019 12:38 PM UTC

Hi Joao, 

Thanks for contacting Syncfusion support. 

By default, focus on the first cell of edit form while editing our EJ2 Grid and we suggest you to use the focus the clicked “td” element on editing by using the “actionBegin” and “actionComplete” events. In the “actionBegin” the event we have updated the “focusIndex” with the currently edited cell and in the “actionComplete” we have focused the currently edited cell. Please find the below code example below, 
export class NormalEdit extends SampleBase { 
        constructor() { 
         .     .      .      . 
            this.focusIndex = null; 
        actionBegin(args) { 
            if (args.requestType == "beginEdit") { 
                this.focusIndex = document.activeElement.cellIndex; 
         .     .     .      . 
        actionComplete(args) { 
            if (args.requestType == "beginEdit") { 
                args.row.querySelector('#' + this.gridInstance.element.id + this.gridInstance.columns[this.focusIndex].field).select(); 
        render() { 
            return (<div className='control-pane'> 
                <div className='control-section'> 
                    <div className='col-md-9'> 
                        <GridComponent dataSource={orderDataSource} width={400} actionComplete={this.actionComplete.bind(this)} ref={grid => this.gridInstance = grid} toolbar={this.toolbarOptions} allowPaging={true} editSettings={this.editSettings} pageSettings={this.pageSettings} actionBegin={this.actionBegin.bind(this)}> 
                            <Inject services={[Page, Toolbar, Edit]} /> 
Balaji Sekar. 

JC Joao Caetano August 23, 2019 02:01 PM UTC

Sorry for the late response
I used the code that you sugested on our project and it didn't work
Then I used in the syncfusion example and it didn't work either
Could you suggest anything else?
Best regards

TS Thavasianand Sankaranarayanan Syncfusion Team August 27, 2019 02:18 PM UTC

Hi Joao, 

We can achieve your requirement by using the below way and we have prepared a sample in the following link. 

If you still face the same issue then please reproduce the issue in the above attached sample. 

Thavasianand S. 

Live Chat Icon For mobile
Up arrow icon