@@ -35,6 +35,12 @@ module Kitos.Utility.KendoGrid {
3535 optionalContext ?: any ;
3636 }
3737
38+ export enum KendoColumnAlignment {
39+ Left ,
40+ Right ,
41+ Center
42+ }
43+
3844 export interface IKendoGridColumnBuilder < TDataSource > {
3945 withId ( id : string ) : IKendoGridColumnBuilder < TDataSource > ;
4046 withDataSourceName ( name : string ) : IKendoGridColumnBuilder < TDataSource > ;
@@ -50,11 +56,11 @@ module Kitos.Utility.KendoGrid {
5056 withContentOverflow ( ) : IKendoGridColumnBuilder < TDataSource > ;
5157 withExcelOutput ( excelOutput : ( source : TDataSource ) => string ) : IKendoGridColumnBuilder < TDataSource > ;
5258 withSourceValueEchoExcelOutput ( ) : IKendoGridColumnBuilder < TDataSource > ;
59+ withContentAlignment ( alignment : KendoColumnAlignment ) : IKendoGridColumnBuilder < TDataSource > ;
5360 build ( ) : IExtendedKendoGridColumn < TDataSource > ;
5461 }
5562
5663 class KendoGridColumnBuilder < TDataSource > implements IKendoGridColumnBuilder < TDataSource > {
57-
5864 private standardWidth : number = 200 ;
5965 private dataSourceName : string = null ;
6066 private title : string = null ;
@@ -69,6 +75,12 @@ module Kitos.Utility.KendoGrid {
6975 private visible = true ;
7076 private dataSourceType : KendoGridColumnDataSourceType = null ;
7177 private contentOverflow : boolean | null = null ;
78+ private contentAlignment : KendoColumnAlignment | null = null ;
79+
80+ withContentAlignment ( alignment : KendoColumnAlignment ) : IKendoGridColumnBuilder < TDataSource > {
81+ this . contentAlignment = alignment ;
82+ return this ;
83+ }
7284
7385 withContentOverflow ( ) : IKendoGridColumnBuilder < TDataSource > {
7486 this . contentOverflow = true ;
@@ -263,8 +275,28 @@ module Kitos.Utility.KendoGrid {
263275 const attributes = {
264276 "data-element-type" : `${ this . id } KendoObject`
265277 } ;
278+
279+ const classes : string [ ] = [ ] ;
266280 if ( this . contentOverflow ) {
267- attributes [ "class" ] = "might-overflow" ;
281+ classes . push ( "might-overflow" ) ;
282+ }
283+ if ( this . contentAlignment != null ) {
284+ switch ( this . contentAlignment ) {
285+ case KendoColumnAlignment . Left :
286+ classes . push ( "text-left" ) ;
287+ break ;
288+ case KendoColumnAlignment . Right :
289+ classes . push ( "text-right" ) ;
290+ break ;
291+ case KendoColumnAlignment . Center :
292+ classes . push ( "text-center" ) ;
293+ break ;
294+ default :
295+ throw `Unsupported alignment type:${ this . contentAlignment } ` ;
296+ }
297+ }
298+ if ( classes . length > 0 ) {
299+ attributes [ "class" ] = classes . join ( " " ) ;
268300 }
269301 return {
270302 field : this . dataSourceName ,
0 commit comments