Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何在dataview中创建水平滚动条_Html_Css_Sass_Scrollbar_Horizontal Scrolling - Fatal编程技术网

Html 如何在dataview中创建水平滚动条

Html 如何在dataview中创建水平滚动条,html,css,sass,scrollbar,horizontal-scrolling,Html,Css,Sass,Scrollbar,Horizontal Scrolling,我有一个Priming tableview,当前的样式是width:100%,所有列的宽度都是以百分比设置的,因此如果数据很长,数据会被包装,并且有一个换行符,这会使行变高。 我希望在特定的列包含大量字符的数据的情况下,在表视图的底部会出现一个水平滚动条-允许我们滚动。我如何使用css实现它。 这是我的(简化版): 将DataGrid放入ScrollViewer标记中,然后设置高度、宽度等。代码示例如下所示 <Grid> <GroupBox>

我有一个Priming tableview,当前的样式是width:100%,所有列的宽度都是以百分比设置的,因此如果数据很长,数据会被包装,并且有一个换行符,这会使行变高。 我希望在特定的列包含大量字符的数据的情况下,在表视图的底部会出现一个水平滚动条-允许我们滚动。我如何使用css实现它。 这是我的(简化版):


将DataGrid放入ScrollViewer标记中,然后设置高度、宽度等。代码示例如下所示

 <Grid>
           <GroupBox>
               <StackPanel Orientation="Horizontal" >
                   <ScrollViewer  Width="500" ScrollViewer.VerticalScrollBarVisibility="Auto" Foreground="Red">
                       <DataGrid  HorizontalAlignment="Center" AutoGenerateColumns="False" >
                           <DataGrid.Columns>
                           </DataGrid.Columns>
                       </DataGrid>
                   </ScrollViewer>
               </StackPanel>
           </GroupBox>

       </Grid>


add
overflow-x:滚动到你的css它会做的技巧,如果即时消息right@xmaster-作为默认解决方案这样做-情况并非如此
div.container
{
    width: auto;
    display: block;

    margin: auto;
    border: 1px solid gray;
    div.data-container
    {
        padding:2vw 2vw 1vw 2vw;
    }

    div.table-view-container
    {
        ::ng-deep p-dataView
        {
            p-header
            {
                div.ui-g
                {
                    margin-left: 17px; //For the left scrolbar
                }
            }
            div.ui-dataview.ui-widget.ui-dataview-list
            {
                div.ui-dataview-content
                {
                    overflow-y: auto;
                }
            }
        }
    }
}
p-dataview
{
    div.ui-g.custom
    {
        box-sizing: border-box;
        padding: .5em  0;
        div.row
        {
            text-align: center;
        }
        div.ui-g10
        {
            width: 10%        
        }

        div.ui-g20
        {
            width: 20%;
        }
        div.ui-g30
        {
            width: 30%;
        }
        div.ui-g40
        {
             width: 40%;
        }
        div.auto-width
        {
            width: auto;
        }
    }
}
 <Grid>
           <GroupBox>
               <StackPanel Orientation="Horizontal" >
                   <ScrollViewer  Width="500" ScrollViewer.VerticalScrollBarVisibility="Auto" Foreground="Red">
                       <DataGrid  HorizontalAlignment="Center" AutoGenerateColumns="False" >
                           <DataGrid.Columns>
                           </DataGrid.Columns>
                       </DataGrid>
                   </ScrollViewer>
               </StackPanel>
           </GroupBox>

       </Grid>