BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
I have a grid with a lots of data and there are cases where having a horizontal scrollbar on top of the grid along with the existing one at the bottom will be helpful to end users. I was wondering if there is any way to implement this - horizontal scrollbar in Syncfusion Angular in Blazor as well.
Any help would be very much appreciated.
Hi Nick,
Sorry for the Inconvenience.
We are currently Validating the reported query at our end and we will update the further details within two business days(June 17, 2022). Until then we appreciate your patience.
Regards,
Naveen Palanivel.
Hi Nick,
Greetings from Syncfusion support.
We checked your Query , you want scrollbar on top and Bottom. We achieved your requirement by javascript and we prepared sample attached in this ticket. Please refer the attached sample for your reference.
Kindly get back to us if you have further queries.
Regards,
Naveen Palanivel.
The horizontal scrollbar works except when one of the column is frozen. Please take a look at the attached sample.
Hi Nick,
We checked your Query , you want scrollbar on top and Bottom works except when one of the column is frozen. We achieved your requirement by javascript and we prepared sample attached in this ticket. Please refer the attached sample for your reference.
Kindly get back to us if you have further queries.
Regards,
Naveen Palanivel.
I have two queries:
Hi Nick,
Sorry for the Inconvenience.
We are currently Validating the reported query at our end and we will update the further details within two business days(June 24, 2022). Until then we appreciate your patience.
Regards,
Naveen Palanivel.
Hi Nick,
Sorry for the Inconvenience.
We are currently Validating the reported query at our end and we will update the further details within one business days(June 28, 2022). Until then we appreciate your patience.
Regards,
Naveen Palanivel.
Hi Nick,
Sorry for the delay in getting back to you.
Query1: “The top scrollbar stays even when the width of the grid content is less than the width of the grid.”
We are able to reproduce the reported issue at our end also. We have resolved the reported issue by making the changes in the JavaScript scroll method. Refer to the modified sample in the attachments for your reference
Please get back to us if you have further queries.
Query2: “n the picture below, Main Fields column does not have autofit but the text wrap property is not added.”
By default cell text will be wrapped only when column content exceeds column width. But in the attached sample, you have defined the Grid component width as 1200 pixels and on hiding all other columns using column chooser. In the movable part, only the Main Fields column alone exist and its width will be auto-adjusted to the remaining space in the Grid. Hence the Text wrap is not applied to that column when all other columns were hidden.
This is the default behavior of Grid.
Regards,
Vignesh Natarajan
I am coming across another issue where the top scrollbar doesn't adjust when re-ordering is done when columns freeze is true, like shown in the image below.
Hi Nick,
Sorry for the Inconvenience.
We are currently checking the reported case at our end and we
will update the further details in three business day as promised (July 12, 2022). Until then we appreciate your patience.
Regards,
Naveen Palanivel
Hi Nick,
Sorry for the Inconvenience.
We are currently checking the reported case at our end and we will update the further details in three business day as promised (July 18, 2022). Until then we appreciate your patience.
Regards,
Naveen Palanivel
When can I expect an update on this?
Hi Nick,
Sorry for the Inconvenience.
We checked your Query , you facing the issue when top scrollbar doesn't adjust when re-ordering is done when columns freeze is true,. We achieved your requirement by javascript and we prepared sample attached in this ticket. Please refer the attached sample for your reference.
Kindly get back to us if you have further queries.
Regards,
Naveen Palanivel.
I just upgraded from .NET 7 to 8 and package 26.2.7 from 23.2.6. I got the following error whenever I opened up a page that uses the Scroll.js from your sample.
Error: Microsoft.JSInterop.JSException: Cannot read properties of undefined (reading 'scrollWidth')
TypeError: Cannot read properties of undefined (reading 'scrollWidth')
The HTML does not contain 'e-movable content'.
Hi
Nick,
Based on the reported issue, we would like to inform you that we have updated
the frozen feature by replacing the previous three-table approach with a
single-table approach in version 24.1.41. You can find more details in
the release notes: https://blazor.syncfusion.com/documentation/release-notes/24.1.41?type=all#data-grid.
Due to these breaking changes, you may have encountered the issue. So, we
suggest using the modified code snippet and sample below to achieve your
requirements. Thank you for your understanding.
public async Task RefreshTopScroll() {
await JSRuntime.InvokeVoidAsync("Scroll");
} var scroll = document.getElementById('wrapper1'); var grid = document.getElementsByClassName('e-grid')[0].ej2_instances[0]; var content = document.getElementsByClassName('e-gridcontent')[0]; // Get content
if (scroll && content) { grid.element.insertBefore(scroll, content); // Place the scrollbar between the content and header
var wrapper1 = document.getElementById("wrapper1"); wrapper1.style.display = "block";
// Adjust width of the scrollbar wrapper document.getElementById("div1").style.width = content.firstElementChild.scrollWidth + "px";
// Bind onscroll event to the wrapper wrapper1.onscroll = function () { content.firstElementChild.scrollLeft = wrapper1.scrollLeft; // Sync wrapper1 scrollLeft with the Grid scrollLeft };
// Bind onscroll event to the content content.firstElementChild.onscroll = function () { wrapper1.scrollLeft = content.firstElementChild.scrollLeft; // Sync Grid scrollLeft with the wrapper1 scrollLeft }; } } |
Regards,
Prathap Senthil
Hi,
The code works but if users switch between pages before the grid data finishes loading the following line in Scroll.js throws an undefined ej2_instances error.
var grid = document.getElementsByClassName('e-grid')[0].ej2_instances[0];
I am calling the script during the grid DataBound event and this method executes even when the user navigates from the page.
We are unable to reproduce the reported issue . For your reference, we have attached a screenshot. To further investigate the issue, we need additional clarification from your side. Please provide the following details to help us proceed:
|
The information you provide will be very helpful in validating the reported
query on our end and in providing a solution as quickly as possible. Thank you
for your understanding.
Hi,
I was having a similar requirement to show scrollbar on top and bottom of the grid and I could achieve it by following your code sample from this thread. But, is it possible to make top scrollbar as sticky. Currently my grid column header is made sticky by applying EnableStickyHeader="true" on SfGrid. Scrollbar appears just below grid header which is perect. But, I want both header and scrollbar to be made sticky. Thanks.
Hi,
Also, noticed that top scrollbar does not retain its position when there is any action event in column header such as sorting or filtering. Scrollbar at grid bottom (default grid scrollbar) retains its position, but top scrollbar just goes to the initial leftmost position. Please help.
Based on your requirement, we suggest using the modified code snippet below in the scroll.js file to handle the scrollbar as sticky and achieve your requirement. Kindly refer to the code snippet and sample for your reference
function Scroll() { var scroll = document.getElementById('wrapper1'); var grid = document.getElementsByClassName('e-grid')[0].ej2_instances[0]; var content = document.getElementsByClassName('e-gridcontent')[0]; // Get content var headerContent = document.getElementsByClassName('e-headercontent')[0]; // Get header content if (scroll && content) { grid.element.insertBefore(scroll, content); // Place the scrollbar between the content and header
var wrapper1 = document.getElementById("wrapper1"); wrapper1.style.display = "block"; wrapper1.style.position = "sticky"; wrapper1.style.zIndex = "10";
// Function to update the top position
function updateTopPosition() { var stickyHeader = document.querySelector('.e-gridheader.e-sticky'); var topPosition = headerContent.offsetHeight;
if (stickyHeader) { topPosition = stickyHeader.getBoundingClientRect().bottom; }
wrapper1.style.top = topPosition + "px"; } // Initial call to set the top position updateTopPosition();
// Adjust width of the scrollbar wrapper document.getElementById("div1").style.width = content.firstElementChild.scrollWidth + "px";
// Bind onscroll event to the wrapper wrapper1.onscroll = function () { content.firstElementChild.scrollLeft = wrapper1.scrollLeft; // Sync wrapper1 scrollLeft with the Grid scrollLeft };
// Bind onscroll event to the content content.firstElementChild.onscroll = function () { wrapper1.scrollLeft = content.firstElementChild.scrollLeft; // Sync Grid scrollLeft with the wrapper1 scrollLeft };
// Adjust position on scroll window.addEventListener('scroll', updateTopPosition); } } |
Hi,
Thanks. But, your suggestions did not solve the problems. I tried your code as well and problems seem to be unresolved.
Problem 1 - Grid's top scrollbar does not remain sticky when page is scrolled down.
Problem 2 - Grid's top scrollbar does not retain its scrolled position when user selects any action on grid column header such as sorting or filtering.
Please see attached screenshots explaining the problems.
Problem
1 - Grid's top scrollbar does not remain sticky when page is scrolled down.
We are unable to reproduce the reported issue. For your reference, we have
attached a screen recording. To further investigate the problem, we require
additional clarification from your end. Please share the details below so we
can proceed accordingly.
Above-requested details will be very helpful in validating the reported query at our end and providing a solution as early as possible. Thanks for your understanding.
Problem 2 - Grid's top scrollbar does not retain its scrolled position when
user selects any action on grid column header such as sorting or filtering.
Regarding this issue, when performing a data operation, the DataBound
event is triggered, causing the JavaScript method to be applied again. To
resolve this, you can use a bool property to ensure that the top
scrollbar is not rendered again when the DataBound event is triggered.
Kindly refer to the code snippet and sample below for your reference.
public bool Isfirst { get; set; } = true;
public async Task bound() { if(Isfirst){ await RefreshTopScroll(); Isfirst = false; }
|
Please refer to the below attached screen recording for your reference.
Hi, Thanks.
First problem was probably some issue at my end, maybe due to caching in browser, but got resolved and is working as expected now.
Second problem got resolved with your suggestion.
I just want to take this opportunity to thank and appreciate you as well as other Syncfusion support team members in this forum who have been patient enough to understand various requirements, problems and answer appropriately with relevant code sample and documentation. This is especially great for people like me who are not very good at UI coding, Javascript, CSS etc. and you guys sometimes going extra length to resolve the problem instead of just providing links to Syncfusion documentation. I hope answers provided to questions in such detail will continue to help other Syncfusion blazor forum members in future.
Thanks again!
Hi Sandip,
We're glad to hear that your issues have been resolved. If you have any further questions or need assistance in the future, feel free to reach out. We're always happy to help!
Best
regards,
Naveen