【发布时间】:2018-09-21 16:31:53
【问题描述】:
我们如何在 ng2-smart-table 中将文本右对齐?
【问题讨论】:
我们如何在 ng2-smart-table 中将文本右对齐?
【问题讨论】:
还有另一种方法,只使用 css。
将所有列向右移动:
:host /deep/ ng2-smart-table tbody > tr > td{
text-align: right;
}
将所有标题向右移动:
:host /deep/ ng2-smart-table thead th{
text-align: center;
}
将所有输入过滤器向右移动:
:host /deep/ ng2-smart-table thead input-filter input{
text-align: center;
}
等等
【讨论】:
:host ::ng-deep 而不是:host /deep/。谢谢。
试试这个代码,它对我有用。
this.settings.columns["title"] = { "title": this.settings.columns["title"].title, type:'html',valuePrepareFunction: function(value){
return '<div class="customformat"> ' + value + ' </div>'
}};
CSS
:host /deep/ .customformat{ text-align: right; }
【讨论】: