Forum Discussion

lori_'s avatar
lori_
Data Storage
05-14-2025
Solved

Table Widget - Horizontal scroll

I’ve been trying to make the scrollbar always visible on the Table widget. I followed the code suggestions from this post, but after implementing the code, I don’t see any change in the widget.

Is there any other solution to make the scrollbar visible all the time on the Table widget?

Thanks in advance!

  • Hi lori_,

    The length of the scrollbar is automatically calculated by the browser based on the ratio of visible content to total scrollable content. This length cannot be directly controlled with standard CSS. The more content there is to scroll through, the shorter the scrollbar will be. On the other hand, the less content there is, the longer the scrollbar. If all content fits within the visible area, the scrollbar disappears entirely.

    So, the reason the scrollbar disappears on your larger screen is that the entire widget content fits within the visible area, so there’s no need to scroll. When the scrollbar appears on the smaller screen, it is quite long for the same reason: there’s only a small amount of content to scroll through. If the visible area gets smaller (for example, if you add more columns, zoom in on the browser, reduce the browser window size, or widen the left navigation panel), the scrollbar will dynamically become shorter.

    Again, this is standard browser behavior. The only way to change this is by hiding the native scrollbar and building a custom one, which is significantly more complex.

     

5 Replies

  • Hello lori_​,

    I’m following up to see if the solution offered by TriAnthony​ worked for you.

    If so, please click the 'Accept as Solution' button on the appropriate post. That way other users with the same questions can find the answer. If not, please let us know so that we can continue to help.

    Thank you.

  • Hello lori_,

    I’m following up to see if the solution offered by TriAnthony worked for you.

    If so, please click the 'Accept as Solution' button on the appropriate post. That way other users with the same questions can find the answer. If not, please let us know so that we can continue to help.

    Thank you.

  • lori_'s avatar
    lori_
    Data Storage

    Thank you for your answer TriAnthony !

    The code worked now, but the second table took a while to receive the update, and when I switch screens, it disappears.

    First table:

    Second table: it has disappeared when switching the screen.

    When I switch to the initial screen (which is smaller), the scrollbar appears on both tables, but it is too long to the table size – making it practically unusable.

     

     

     

    • TriAnthony's avatar
      TriAnthony
      Admin

      Hi lori_,

      The length of the scrollbar is automatically calculated by the browser based on the ratio of visible content to total scrollable content. This length cannot be directly controlled with standard CSS. The more content there is to scroll through, the shorter the scrollbar will be. On the other hand, the less content there is, the longer the scrollbar. If all content fits within the visible area, the scrollbar disappears entirely.

      So, the reason the scrollbar disappears on your larger screen is that the entire widget content fits within the visible area, so there’s no need to scroll. When the scrollbar appears on the smaller screen, it is quite long for the same reason: there’s only a small amount of content to scroll through. If the visible area gets smaller (for example, if you add more columns, zoom in on the browser, reduce the browser window size, or widen the left navigation panel), the scrollbar will dynamically become shorter.

      Again, this is standard browser behavior. The only way to change this is by hiding the native scrollbar and building a custom one, which is significantly more complex.

       

  • Hi lori_,

    I tried the script that Vitalii provided in the post you mentioned, and it works for me (see screenshot below for reference). Could you confirm if the below is the script you're using and that it was added as a widget script to the Table widget? If so, which version of Sisense are you using, and is it Linux or Windows?

    const scrollClasses = [
    	'.dataTables_scrollBody'
    ];
    
    const customStyles = {
    	overflow: 'scroll !important'
    };
    
    
    widget.on('domready', () => {
    	scrollClasses.forEach((className) => {
    		let styles = {};
    
    		$(`${className}`, element).attr('style').split(';').filter(item => item).forEach(item => {
    			const [key, value] = item.split(': ');
    			styles[key.trim()] = value;
    		})
    
    		styles = {...styles, ...customStyles};
    
    		const newStyles = Object.keys(styles).map((style) => `${style}: ${styles[style]}`).join('; ');
    		$(`${className}`, element).attr('style', `${newStyles};`);
    	})
    })