﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - Lounge - Horizontal scrollbar hides when grid is empty</title><link>http://www.intersoftsolutions.com/Community/Lounge/Horizontal-scrollbar-hides-when-grid-is-empty/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Horizontal scrollbar hides when grid is empty</title><link>http://www.intersoftsolutions.com/Community/Lounge/Horizontal-scrollbar-hides-when-grid-is-empty/</link><pubDate>Tue, 21 Mar 2017 03:59:59 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Sorry for the delay in sending this.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #1f497d;"&gt;When there is no data in the grid, a div element with id is equal to [WebGrid Id]_ND will be shown in the root table of WebGrid. This div element has 100% width.&lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;span&gt;Is there a way to force the horizontal scrollbar to show at all times?&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;You might want to try my approach by setting the width of the above div element to be equal to the offset width of WebGrid column header.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Following JavaScript snippet code shows how.&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;function WebGrid1_OnAfterResponseProcess(controlId, action) {
    var grid = ISGetObject(controlId);
    var colHeaderTableElm = grid.RootTable.GetElement(WG40.COLHEADER, WG40.HTMLTABLE);
            
    if (grid.RootTable.Rows == null)
        document.getElementById(controlId + "_ND").style.width = colHeaderTableElm.offsetWidth + "px";

    return true;
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;I'm using OnAfterResponseProcess client-side event of WebGrid. This event is invoked after the response of a request has been received. The if clause checks if grid.RootTable.Rows is null, then set the width of the div element.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Horizontal scrollbar hides when grid is empty</title><link>http://www.intersoftsolutions.com/Community/Lounge/Horizontal-scrollbar-hides-when-grid-is-empty/</link><pubDate>Thu, 02 Mar 2017 16:42:22 GMT</pubDate><dc:creator>JamesM</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;I have found that if I create a grid with a fixed width narrower than the total column width a scrollbar is created. The problem is that if there is no data in the grid, the scrollbar does not show and users are unable to see the filter headers off the right of the screen without tabbing along. As my users would prefer to scroll along, currently they must enter something into the filter to search for data, scroll to the preferred header, then enter the filter they wanted before.&lt;/p&gt;&lt;p&gt;Is there a way to force the horizontal scrollbar to show at all times?&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;</description></item></channel></rss>