- Home
- Forum
- ASP.NET Core - EJ 2
- Scroll right to specific column name
Scroll right to specific column name
Is there some way to scroll right to specific column name after the data is loaded on the page?
Hi Bernard Jurlina,
Greetings from Syncfusion Support.
We have reviewed your query about scrolling the grid content to specific column in the initial loading of the grid. We suggest you to set scrollLeft for the grid content element based on the column index for which you need to position the scroll in the dataBound event of the grid. We have attached the code snippet of the implementation and sample for your reference.
|
<ejs-grid id="Grid" width='800' dataBound='dataBound'> . . .
<script> let initialRender = true; function dataBound() { if (initialRender) { var gridInstance = document.getElementById('Grid').ej2_instances[0]; if (gridInstance) { const gridElement = gridInstance.element.querySelector('.e-content'); // Get the index of the desired column const columnIndex = gridInstance.getColumnIndexByField('ShipRegion'); // Calculate the scroll position based on column widths let scrollLeft = 0; for (let i = 0; i < columnIndex; i++) { // Adjust the scrollLeft calculation based on your column widths scrollLeft += 100; } // Set the scroll position gridElement.scrollLeft = scrollLeft; } initialRender = false; // Update initialRender flag to false after first render } } </script>
|
If this didn’t meet you requirement, please provide the following information which will help us to validate further.
- Please provide the detailed explanation of your requirement, which will help us to understand better and provide solution based on that.
- Please provide the complete grid rendering code, since we are unaware of the properties you have used in your code.
Regards,
Dineshnarasimman M
Attachment: CoreGridAppScrolling_40e62430.zip
Hi Dineshnarasimman!
Everything is working great! Thanks for the example.
Regards,
Bernard.
Hi Bernard Jurlina,
You are most welcome! Please get back to us if you need any other assistance.
Regards
Aishwarya R
- 3 Replies
- 3 Participants
-
BJ Bernard Jurlina
- Jun 24, 2024 09:18 AM UTC
- Jun 27, 2024 06:27 AM UTC