- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Angular Material 和弹性布局来处理 Angular 2。我已经实现了 mat-sidenav 并采用了一些 mat-form-field 并且还实现了 mat-table
我只为 mat-table 组件指定了最大高度,但是除了 mat-table< 的垂直滚动条之外,我还得到了页面的水平和垂直滚动条/strong>
谁能帮我解决如何避免这些滚动条......?
请访问我的示例代码here
<mat-sidenav-container>
<mat-sidenav #sidenav>
<div class="sidenav-header">
<mat-nav-list>
<h3 mat-subheader>Status At A Glance</h3>
<a mat-list-item routerLink='' routerLinkActive="active">Not Started</a>
<a mat-list-item routerLink='' routerLinkActive="active">Incomplete</a>
<a mat-list-item routerLink='' routerLinkActive="active">Complete</a>
<mat-divider></mat-divider>
<a mat-list-item routerLink='' routerLinkActive="active">Total</a>
<mat-divider></mat-divider>
<mat-form-field floatPlaceholder="never" style="width:150px; height:15px; margin-left:10px; font-size:12px; font-family: Verdana,Sans-Serif;">
<mat-select placeholder=" Select Department" [(value)]="selecteddept" style="width:150px;">
<input class="input1" matInput type="text">
<mat-option *ngFor="let Department of departments " [value]="Department.value" style="font-size:12px; font-family: Verdana,Sans-Serif; margin:-5px 0 -5px 0;">
{{Department.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-divider></mat-divider>
<h3 mat-subheader>Space Administration </h3>
<a mat-list-item routerLink='/Home/SurveyTools/RemoveRoomFromList' routerLinkActive="active">Remove Room From List</a>
<a mat-list-item routerLink='/Home/SurveyTools/RequestRoom' routerLinkActive="active">Request A Room </a>
<a mat-list-item routerLink='/Home/SurveyTools/SplitRoomMultiplePi' routerLinkActive="active">Split Room - Multiple PI's</a>
<a mat-list-item routerLink='/SpaceAdmin/BlockCode/BlockCode' routerLinkActive="active">Block Code</a>
<a mat-list-item>Lab Support Rooms</a>
<mat-divider></mat-divider>
<h3 mat-subheader>Survey Tools</h3>
<a mat-list-item>Create New Lab Cluster</a>
<a mat-list-item>Blank Survey Form </a>
<a mat-list-item>Common Task</a>
<a mat-list-item>Survey Instruction</a>
<a mat-list-item>User Guide</a>
<mat-divider></mat-divider>
</mat-nav-list>
</div>
</mat-sidenav>
<div [ngStyle]="{'display' : (screenWidth > 840) ? 'none' : 'block'}">
<div fxLayout="row" fxLayoutAlign=" start stretch">
<a (click)="sidenav.open()">
<mat-icon>menu</mat-icon>
</a> 
<h1> SPACE SURVEY </h1>
</div>
<p style="margin:-5px; text-align:center;">   If you need help, Please <strong><a href="#visit our detailed instruction">visit our detailed instruction </a></strong> on how to use this site.</p>
</div>
<div>
<div fxLayout="row" fxLayout.xs="column" fxLayoutAlign="space-evenly center">
<mat-form-field floatPlaceholder="never">
<mat-select placeholder=" Department">
<input class="input1" matInput type="text">
<mat-option *ngFor="let Department of department " [value]="Department.value">
{{Department.viewValue }}
</mat-option>
</mat-select>
</mat-form-field><br/>
<mat-form-field floatPlaceholder="never">
<mat-select placeholder="Building ">
<input class="input1" matInput type="text">
<mat-option *ngFor="let Building of buildings " [value]="Building.value">
{{ Building.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
</div><br/>
<div fxLayout="row" fxLayout.xs="column" fxLayoutAlign="space-evenly center">
<mat-form-field floatPlaceholder="never">
<mat-select placeholder=" Sub Department">
<input class="input1" matInput type="text">
<mat-option *ngFor="let subdepartment of subdepartments " [value]="subdepartment.value">
{{ subdepartment.viewValue }}
</mat-option>
</mat-select>
</mat-form-field><br/>
<mat-form-field floatPlaceholder="never">
<mat-select placeholder=" Floor">
<input class="input1" matInput type="text">
<mat-option *ngFor="let floor of floors" [value]="floor.value">
{{ floor.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
</div><br/>
<div fxLayout="row" fxLayout.xs="column" fxLayoutAlign="space-evenly center">
<mat-form-field floatPlaceholder="never">
<mat-select placeholder=" Status">
<input class="input1" matInput type="text">
<mat-option *ngFor="let status of statuses" [value]="status.value">
{{ status.viewValue }}
</mat-option>
</mat-select>
</mat-form-field> <br/>
<mat-form-field floatPlaceholder="never">
<mat-select placeholder=" Room Type ">
<input class="input1" matInput type="text">
<mat-option *ngFor="let roomtype of roomtypes" [value]="roomtype.value">
{{ roomtype.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
</div><br/>
<div fxLayout="row" fxLayout.xs="column" fxLayoutAlign="space-evenly center">
<mat-input-container floatPlaceholder="never">
<input matInput placeholder=" Responsible Person ">
</mat-input-container> <br/>
<mat-input-container floatPlaceholder="never">
<input matInput placeholder=" Room Number ">
</mat-input-container>
</div>
</div>
<br/>
<div fxLayout="row" fxLayoutAlign="center center">
<button mat-raised-button color="primary">View All</button><br/>
</div> <br/>
<div class="material-table mat-elevation-z8">
<mat-table #table [dataSource]="dataSource">
<!-- Checkbox Column -->
<ng-container matColumnDef="select">
<mat-header-cell style="max-width:50px;" *matHeaderCellDef>
<mat-checkbox (change)="$event ? masterToggle() : null" [checked]="selection.hasValue() && isAllSelected()" [indeterminate]="selection.hasValue() && !isAllSelected()">
</mat-checkbox>
</mat-header-cell>
<mat-cell style="max-width:50px;" *matCellDef="let row">
<mat-checkbox (click)="$event.stopPropagation()" (change)="$event ? selection.toggle(row) : null" [checked]="selection.isSelected(row)">
</mat-checkbox>
</mat-cell>
</ng-container>
<ng-container matColumnDef="num">
<mat-header-cell style="max-width:0px;" *matHeaderCellDef> </mat-header-cell>
<mat-cell style="max-width:0px;" *matCellDef="let element"></mat-cell>
</ng-container>
<ng-container matColumnDef="statuses">
<mat-header-cell *matHeaderCellDef> Completion Status </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.statuses}}</mat-cell>
</ng-container>
<ng-container matColumnDef="building">
<mat-header-cell style="text-align:left; padding-left:70px;" *matHeaderCellDef> Building </mat-header-cell>
<mat-cell style="text-align:left; padding-left:70px;" *matCellDef="let element"> {{element.building}} </mat-cell>
</ng-container>
<ng-container matColumnDef="floor">
<mat-header-cell *matHeaderCellDef> Floor </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.floor}} </mat-cell>
</ng-container>
<ng-container matColumnDef="roomtype">
<mat-header-cell *matHeaderCellDef> Room No. </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.roomtype}} </mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;" (click)="selection.toggle(row)">
</mat-row>
</mat-table>
<div style=height:30px;>
<mat-paginator #paginator [pageSize]="9" [pageSizeOptions]="[5, 10, 25, 100]">
</mat-paginator>
</div>
</div>
</mat-sidenav-container>
h1,h2 {
font-family: Verdana, sans-serif;
color:#1a084c;
font-weight:bold;
font-size:14px;
}
.mat-raised-button{
border-radius: 15px;
font-size:12px;
font-family: Verdana,Sans-Serif;
text-align:center;
font-weight:bold;
height:30px;
}
mat-form-field, mat-input-container{
font-family: Verdana, sans-serif;
color:#1a084c;
font-size:11px;
height:10px;
width:300px;
}
mat-select{
font-family: Verdana, sans-serif;
color:#1a084c;
font-size:11px;
width:300px;
}
//styles for material -table
mat-header-cell, mat-header-row, .mat-header-cell-def{
background:#f2f4f7;
min-height:15px;
font-family:Verdana,sans-serif;
font-weight:bold;
font-size:13px;
color: #1a084c;
margin-bottom:5px;
top: 0;
position: sticky;
z-index: 1;
}
mat-row{
min-height:20px;
font-family:Verdana,sans-serif;
font-size:11px;
color: #1a084c;
}
mat-cell{
height:20px;
font-family:Verdana,sans-serif;
font-size:11px;
color: #1a084c;
}
.example-container {
display: flex;
flex-direction: column;
max-height: 180px;
margin:auto;
}
.mat-table {
font-size:11px;
font-family: Verdana,Sans-Serif;
color: #1a084c;
overflow: auto;
max-height: 180px;
}
mat-header-cell, mat-header-row, .mat-header-cell-def{
background:#f2f4f7;
min-height:15px;
font-family:Verdana,sans-serif;
font-weight:bold;
font-size:13px;
color: #1a084c;
margin-bottom:5px;
top: 0;
position: sticky;
z-index: 1;
}
mat-row{
min-height:20px;
font-family:Verdana,sans-serif;
font-size:11px;
color: #1a084c;
}
mat-cell{
height:20px;
font-family:Verdana,sans-serif;
font-size:11px;
color: #1a084c;
}
@media only screen and (max-width: 736px) and (orientation:portrait) {
mat-header-row, mat-row {
width: 200%;
}
}
//style for the paginator
mat-paginator{
}
.mat-paginator-container{
float:right;
}
.mat-subheader{
font-family: Verdana, sans-serif;
font-size: 13px;
font-weight:bold;
background-color: #f2f4f7;
height:8px;
margin-top:5px;
}
.mat-list-item{
font-family: Verdana, sans-serif;
font-size: 12px;
height: 20px;
}
.mat-list-item:visited {
color: #0c0c28;
background-color: transparent;
text-decoration: none;
}
.mat-list-item:hover {
color: #0c0c28;
background-color: transparent;
text-decoration: underline;
font-weight: bold;
}
.mat-list-item:active {
color: #0c0c28;
background-color: transparent;
text-decoration: underline;
}
import { SelectionModel } from '@angular/cdk/collections';
import { Component, OnInit, ViewChild, Inject } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
/**
* @title Table with selection
*/
@Component({
selector: 'table-selection-example',
styleUrls: ['table-selection-example.css'],
templateUrl: 'table-selection-example.html',
encapsulation: ViewEncapsulation.None
})
export class TableSelectionExample {
selecteddept: string;
departments = [
{value: 'Department 1', viewValue: 'Department 1'},
{value: 'Department 2', viewValue: 'Department 2'},
{value: 'Department 3', viewValue: 'Department 3'}
];
department = [
{value: ' ASB ', viewValue: ' ASB '},
{value: 'BIOCHEMISTRY 2', viewValue: 'BIOCHEMISTRY 2'},
{value: 'BUDGET AND COST 3', viewValue: 'BUDGET AND COST 3'},
{value: ' CANCER CTR ', viewValue: ' CANCER CTR '},
{value: 'CARDIOTHOR SURG 2', viewValue: 'CARDIOTHOR SURG 2'},
{value: 'CELL BIOLOGY', viewValue: 'CELL BIOLOGY'},
{value: ' DMB ', viewValue: ' DMB '},
{value: 'DUPLICATING SVCS', viewValue: 'DUPLICATING SVCS'},
{value: 'EMERGENCY MEDICINE', viewValue: 'EMERGENCY MEDICINE'}
];
buildings = [
{value: 'Alpha', viewValue: 'Alpha '},
{value: 'Beta ', viewValue: 'Beta '},
{value: 'Gamma ', viewValue: 'Gamma '},
{value: 'delta ', viewValue: 'delta '},
{value: 'ribon ', viewValue: 'ribon '}
];
subdepartments = [
{value: 'Sdept', viewValue: 'Sdept'},
{value: 'bdept', viewValue: 'bdept'},
{value: 'cdept', viewValue: 'cdept'},
{value: 'zdept', viewValue: 'zdept'},
{value: 'ldept', viewValue: 'ldept'},
{value: 'mdept', viewValue: 'mdept'}
];
floors = [
{value: 'first', viewValue: 'first'},
{value: 'second', viewValue: 'second'},
{value: 'third', viewValue: 'third'}
];
statuses = [
{value: 'Status 1', viewValue: 'Status 1'},
{value: 'Status 2', viewValue: 'Status 2'},
{value: 'Status 3', viewValue: 'Status 3'}
];
roomtypes = [
{value: ' 1', viewValue: ' 1'},
{value: ' 2', viewValue: ' 2'},
{value: ' 3', viewValue: ' 3'}
];
constructor(public showmenu:ShowmenuService, private _activateroute: ActivatedRoute) { }
ngOnInit() {
this.showmenu.show();
this.showmenu.show1();
}
displayedColumns = ['num', 'select','statuses', 'building', 'floor', 'roomtype'];
dataSource = new MatTableDataSource<Element>(ELEMENT_DATA);
selection = new SelectionModel<Element>(true, []);
@ViewChild(MatPaginator) paginator: MatPaginator;
ngAfterViewInit() {
this.dataSource.paginator = this.paginator;
}
/** Whether the number of selected elements matches the total number of rows. */
isAllSelected() {
const numSelected = this.selection.selected.length;
const numRows = this.dataSource.data.length;
return numSelected === numRows;
}
/** Selects all rows if they are not all selected; otherwise clear selection. */
masterToggle() {
this.isAllSelected() ?
this.selection.clear() :
this.dataSource.data.forEach(row => this.selection.select(row));
}
}
export interface Element {
statuses: string;
num: any;
building: string;
floor:string;
roomtype:string;
}
const ELEMENT_DATA: Element[] = [
{num:1,statuses: 'accepted', building: 'Abby', floor:'1',roomtype:'2'},
{num:1,statuses: 'accepted', building: 'Hospital ', floor:'2',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'CBS', floor:'3',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Flexner Hall', floor:'4',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Abby', floor:'5',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Hospital', floor:'5',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'CBS', floor:'6',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Abby', floor:'1',roomtype:'2'},
{num:1,statuses: 'accepted', building: 'Hospital ', floor:'2',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'CBS', floor:'3',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Flexner Hall', floor:'4',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Abby', floor:'5',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'Hospital', floor:'5',roomtype:'1'},
{num:1,statuses: 'accepted', building: 'CBS', floor:'6',roomtype:'1'}
];
最佳答案
你只需要调整mat-row,mat-header-row的字体和宽度,这样它们就可以适应小屏幕并且滚动条会消失:
@media only screen and (max-width: 736px) and (orientation:portrait) {
mat-header-row, mat-row {
width: 100%;
}
mat-row{
font-size:8px;
}
mat-cell{
font-size:8px;
}
关于angular - 如何使用 Angular Material 柔性布局避免 Angular 水平和垂直滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49923712/
我正在用 Ionic 构建一个库,其中一个要求是我不能添加类并且不能使用父元素或容器来修改或访问我们的元素。 带有按钮的搜索字段应该与图片中的一样: 我只有两个兄弟元素: Button 我如何强制搜
我有一个Groovy服务器和Flex客户端。当我尝试从Flex连接到Groovy应用程序时,我显示消息。然后,我发送一些策略XML响应,并尝试将某些内容发送到服务器。但是我没有得到Groovy方面的帮
我有类 com.company.project.views.SomeClass。我有
这是 .lex 文件的片段: /* Empty line just with the newline character signs end of the title block
我正在尝试使用 FLEX 和 BISON 进行一些练习。 这是我写的代码: calc_pol.y %{ #define YYSTYPE double #include "calc_pol.tab.h"
我有两个问题: 我正在尝试通过 this page 嵌入字体在 livedocs 中。 谁能告诉我使用外部样式表需要做什么? 应该它是样式表还是 mxml 文件?我看到了this tutorial ,
我想在背景中有一张图片,在它上面有另一张图片(透明)和一些文字说明。 我尝试了以下代码,但它不起作用,因为它为三个组件分配了三个等号空间。 有没有办法让组件相互叠加? 图片代码: export def
我是 Flex 的新手,只是想玩一下 Mate 框架中的示例应用程序。我在 Linux 上进行黑客攻击,所以我使用的是命令提示符和文本编辑器,而不是 Flex Builder。 示例应用程序在其根目录
在 Flex 中,很容易将 XML 转换为 Object 和 ArrayCollection,方法是使用 var decoder:SimpleXMLDecoder = new SimpleXMLDec
我正在使用 flex 创建一个多列列表,它根据容器的宽度调整列数。 我发现的问题是,如果我想通过将 flex-grow 设置为 1 来使用父级的整个宽度,最后一个换行中的元素会错位,因为它们试图填充父
选择数据网格中所有项目的最佳方式是什么。 我想做一个 for 循环,然后选择每个项目,但有没有更好的方法来实现这一点? 最佳答案 您使用的是什么类型的 dataProvider? 如果你有一个数组,你
根据容器的宽度,是否有可能以及如何实现(如果有)多行 TabBar? 最佳答案 就像给 TabBar 一个 TileLayout 一样简单。您不必继承 TabBar,甚至不必为它创建自定义外观类。只需
好的,我有一个 HTTPService,只要它从 send() 调用获得结果,它就会执行 dataLoaded(e:ResultEvent):void 函数。 好的,所以如果我调用 HTTPServi
所以文档有这个漂亮的“in”运算符,我更喜欢使用多步骤或语句 (||) 的想法。文档给了我这个例子。 trace("PI" in Math); // true trace("myPro
我正在尝试在 Flex 中执行与 PHP ucwords() 等效的操作。我不希望整个字符串大写,只是每个单词的第一个字母。有谁知道方法吗? 谢谢! 最佳答案 尝试 str.replace(/\b./
我花了两天的时间绞尽脑汁试图找出程序为什么会这样。对于一个类(class)项目,我正在尝试编写一个程序来解析地址并以某种方式输出它。在我真正到达程序的输出部分之前,我只是想确保我的 Bison-fu
一切正常,但我希望屏幕较小时居中对齐,它居中对齐,但屏幕之外还有一个空间出现。 代码: .example { line-height: 30px; background-color: #363
我有一个 Flex ActionScript 组件。如何将 CSS 应用到该组件?我希望能够应用来自外部 CSS 文件的样式。 文件“global.css”中的 CSS 选择器: .myPanel {
试图更好地对齐一行的某些小节。我已经设法在同一行上获得“阅读更多”按钮,使用 flex: 1;。但是,我似乎无法很好地对齐图像的顶部和第一段的开头。 布局是一系列 div,里面有文章:
这个问题在这里已经有了答案: Proper use of flex properties when nesting flex containers (1 个回答) 关闭 5 年前。
我是一名优秀的程序员,十分优秀!