Horizontal scroll whitespace in the bottom of the RadGrid

别说谁变了你拦得住时间么 提交于 2019-12-11 02:18:47

问题


I am retrieving data from database using RadGrid. I have more columns in my RadGrid, so I need to show RadGrid horizontal scroll to keep the page from expanding but disable the vertical scroll so height of the grid should expand to always display all rows in the grid. I got the result but there is whitespace in the bottom of the RadGrid.

My UI of the RadGrid:

<table style="table-layout: fixed;" width="100%" cellpadding="0" cellspacing="0"    border="0">

    <tr>

        <td>

            <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="false" PagerStyle-AlwaysVisible="true"

                CellPadding="0" CellSpacing="0" GridLines="None" Skin="Metro" CssClass="RadGrid_CBGrid"

                HorizontalAlign="Left" AutoGenerateColumns="False" OnItemCommand="RadGrid1_ItemCommand"

                OnDataBound="RadGrid1_DataBound">

                <ClientSettings>

                    <Selecting CellSelectionMode="SingleCell"></Selecting>

                    <Scrolling AllowScroll="true" UseStaticHeaders="True"></Scrolling>

                </ClientSettings>

                <MasterTableView HierarchyLoadMode="Client" DataKeyNames="EmpID" AllowMultiColumnSorting="true"

                    Name="Parent">

                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                    <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">

                    </RowIndicatorColumn>

                    <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">

                    </ExpandCollapseColumn>

                    <Columns>

                        <telerik:GridBoundColumn DataField="EmpID" EmptyDataText="NA" HeaderText="Emp ID"

                            UniqueName="EmpID">

                        </telerik:GridBoundColumn>
                      and so on......
                      -------------------
                    </Columns>

                    <EditFormSettings>

                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">

                        </EditColumn>

                    </EditFormSettings>

                </MasterTableView>

                <FilterMenu EnableImageSprites="False">

                </FilterMenu>

            </telerik:RadGrid>

        </td>

    </tr>

</table>

If I changed ClientSettings-Scrolling-AllowScroll="true" in RadGrid and

I got the result and there is NO whitespace in the bottom of the RadGrid BUT Horizontal scroll bar is NOT coming in my RadGrid.

So can anybody please give me the solution.


回答1:


Or if you don't want to worry about hieght calculation do this!

// radgrid scroll horizontal only
<ClientSettings AllowDragToGroup="True" AllowGroupExpandCollapse="true">                    
        <Scrolling AllowScroll="true" />
        <ClientEvents OnGridCreated="GridCreated" />
 </ClientSettings>

function GridCreated(sender, args) {
       $('.rgDataDiv').removeAttr('style');
       $('.rgDataDiv').attr('style', 'overflow-x: scroll;');
}



回答2:


Just change overflow-x property value of data grid to scroll , instead of applying auto. If you have this issue in IE9.



来源:https://stackoverflow.com/questions/13589557/horizontal-scroll-whitespace-in-the-bottom-of-the-radgrid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!