3
votes

How can we align text to right in ng2-smart-table?

2

2 Answers

4
votes

try this code, it works from my side.

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

3
votes

There is another way by using the css only.

To move all columns to the right:

:host /deep/ ng2-smart-table tbody > tr > td{ text-align: right; }

To move all titles to the right:

:host /deep/ ng2-smart-table thead th{ text-align: center; }

To move all input filters to the right:

:host /deep/ ng2-smart-table thead input-filter input{ text-align: center; }

etc.