@@ -29,7 +29,7 @@ module DataTable {
29
29
public selectedLayerId : string ;
30
30
public layerOptions : Array < any > = [ ] ;
31
31
public propertyTypes : Array < IPropertyType > = [ ] ;
32
- public headers : Array < string > = [ ] ;
32
+ public headers : { value : string , type : 'number' | 'other' } [ ] ;
33
33
public sortingColumn : number ;
34
34
public rows : Array < Array < TableField > > = [ ] ;
35
35
private mapFeatureTitle : string ;
@@ -287,19 +287,22 @@ module DataTable {
287
287
this . propertyTypes . push ( csComp . Helpers . GeoExtensions . createPropertyType ( 'Lon' ) ) ;
288
288
289
289
// Select the first couple of headers
290
- const nmbrOfDefaultSelectedHeaders = 3 ;
290
+ const nmbrOfDefaultSelectedHeaders = 4 ;
291
291
for ( var i = 0 ; i < nmbrOfDefaultSelectedHeaders ; i ++ ) {
292
- this . headers . push ( titles [ i ] ) ;
292
+ if ( titles . length > i ) {
293
+ let pt = _ . findWhere ( this . propertyTypes , { 'title' : titles [ i ] } ) ;
294
+ this . headers . push ( { value : titles [ i ] , type : ( pt . type === 'number' ? 'number' : 'other' ) } ) ;
295
+ }
293
296
}
294
297
this . rows = this . getRows ( ) ;
295
298
}
296
299
297
- public toggleSelection ( propertyTypeTitle : string ) {
298
- var idx = this . headers . indexOf ( propertyTypeTitle ) ;
300
+ public toggleSelection ( propertyTypeTitle : string , propertyTypeType : string ) {
301
+ var idx = _ . pluck ( this . headers , 'value' ) . indexOf ( propertyTypeTitle ) ;
299
302
if ( idx > - 1 ) { // is currently selected
300
303
this . headers . splice ( idx , 1 ) ;
301
304
} else { // is newly selected
302
- this . headers . push ( propertyTypeTitle ) ;
305
+ this . headers . push ( { value : propertyTypeTitle , type : ( propertyTypeType === 'number' ? 'number' : 'other' ) } ) ;
303
306
}
304
307
this . rows = this . getRows ( ) ;
305
308
}
@@ -323,7 +326,7 @@ module DataTable {
323
326
var meta : Array < IPropertyType > = [ this . headers . length ] ;
324
327
this . propertyTypes . forEach ( ( mi : IPropertyType ) => {
325
328
// Keep headers and mi in the right order
326
- var index = this . headers . indexOf ( mi . title ) ;
329
+ var index = _ . pluck ( this . headers , 'value' ) . indexOf ( mi . title ) ;
327
330
if ( index >= 0 ) meta [ index ] = mi ;
328
331
} ) ;
329
332
var props : Array < Array < TableField > > = [ ] ;
@@ -491,7 +494,7 @@ module DataTable {
491
494
this . selectAllText = translation ;
492
495
} ) ;
493
496
this . propertyTypes . forEach ( ( mi ) => {
494
- var idx = this . headers . indexOf ( mi . title ) ;
497
+ var idx = _ . pluck ( this . headers , 'value' ) . indexOf ( mi . title ) ;
495
498
if ( idx > - 1 ) {
496
499
this . headers . splice ( idx , 1 ) ;
497
500
}
@@ -502,15 +505,19 @@ module DataTable {
502
505
this . selectAllText = translation ;
503
506
} ) ;
504
507
this . propertyTypes . forEach ( ( mi ) => {
505
- if ( this . headers . indexOf ( mi . title ) <= - 1 ) {
506
- this . headers . push ( mi . title ) ;
508
+ if ( _ . pluck ( this . headers , 'value' ) . indexOf ( mi . title ) <= - 1 ) {
509
+ this . headers . push ( { value : mi . title , type : ( mi . type === 'number' ? 'number' : 'other' ) } ) ;
507
510
}
508
511
} ) ;
509
512
this . rows = this . getRows ( ) ;
510
513
}
511
514
this . selectAllBool = ! this . selectAllBool ;
512
515
}
513
516
517
+ private isHeaderSelected ( title : string ) {
518
+ return _ . pluck ( this . headers , 'value' ) . indexOf ( title ) > - 1 ;
519
+ }
520
+
514
521
private returnToMap ( ) {
515
522
let dashboard = this . $layerService . project . dashboards [ 0 ] ;
516
523
this . $messageBusService . publish ( 'dashboard-main' , 'activated' , dashboard ) ;
0 commit comments