在的RadGrid底部水平滚动空白空白、水平、RadGrid

2023-09-05 04:16:00 作者:在机场等一艘船

我从数据库中使用的RadGrid检索数据。我在我的RadGrid更多的列,所以我需要证明的RadGrid水平滚动保持页面的扩大,但禁用垂直滚动使电网的高度应扩大到始终显示所有行的网格。我得到的结果,但有空白的的RadGrid。

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.

<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>

如果我改变ClientSettings滚动-AllowScroll =真的的RadGrid和

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

我得到的结果,并没有在的RadGrid但水平滚动条的底部没有空格不来我的RadGrid。

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.

推荐答案

或者,如果你不想再担心hieght计算做到这一点!

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;');
}
 
精彩推荐
图片推荐