@@ -11,48 +11,47 @@ import {GridtableService} from '../service/Grid-table.service'
1111
1212export class GridTableComponent implements OnChanges {
1313
14- headers ;
15- attributeNames ;
16- dataInput ;
17-
18- public rowsData = [ ] ;
19- public attributesNames = [ ] ;
20- public tableHeaders = [ ] ;
21-
22- public selection ;
23- objSelected = new EventEmitter ( ) ;
24-
25- public sortIconStyle = [ "glyphicon glyphicon-chevron-down" , "glyphicon glyphicon-chevron-down" , "glyphicon glyphicon-chevron-down" ] ;
26-
27- constructor ( private gridtableService : GridtableService ) {
28- }
29-
30- ngOnChanges ( ) {
31- this . attributesNames = this . attributeNames ;
32- this . tableHeaders = this . headers ;
33- this . rowsData = this . dataInput ;
34- }
35-
36- sortColumn ( column :number , name :string ) {
37-
38- if ( this . sortIconStyle [ column ] === "glyphicon glyphicon-chevron-up" ) {
39- this . sortIconStyle [ column ] = "glyphicon glyphicon-chevron-down" ;
40- this . rowsData = this . gridtableService . getTablesOrderBy ( - 1 , name , this . rowsData ) ;
41- } else {
42- this . sortIconStyle [ 0 ] = "glyphicon glyphicon-chevron-down" ;
43- this . sortIconStyle [ 1 ] = "glyphicon glyphicon-chevron-down" ;
44- this . sortIconStyle [ 2 ] = "glyphicon glyphicon-chevron-down " ;
45- this . sortIconStyle [ column ] = "glyphicon glyphicon-chevron-up" ;
46- this . rowsData = this . gridtableService . getTablesOrderBy ( 1 , name , this . rowsData ) ;
14+ headers ;
15+ attributeNames ;
16+ dataInput ;
17+
18+ public rowsData = [ ] ;
19+ public attributesNames = [ ] ;
20+ public tableHeaders = [ ] ;
21+
22+ public selection ;
23+ objSelected = new EventEmitter ( ) ;
24+
25+ public sortIconStyle = [ "glyphicon glyphicon-chevron-down" , "glyphicon glyphicon-chevron-down" , "glyphicon glyphicon-chevron-down" ] ;
26+
27+ constructor ( private gridtableService : GridtableService ) {
28+ }
29+
30+ ngOnChanges ( ) {
31+ this . attributesNames = this . attributeNames ;
32+ this . tableHeaders = this . headers ;
33+ this . rowsData = this . dataInput ;
34+ }
35+
36+ sortColumn ( column :number , name :string ) {
37+ if ( this . sortIconStyle [ column ] === "glyphicon glyphicon-chevron-up" ) {
38+ this . sortIconStyle [ column ] = "glyphicon glyphicon-chevron-down" ;
39+ this . rowsData = this . gridtableService . getTablesOrderBy ( - 1 , name , this . rowsData ) ;
40+ } else {
41+ this . sortIconStyle [ 0 ] = "glyphicon glyphicon-chevron-down" ;
42+ this . sortIconStyle [ 1 ] = "glyphicon glyphicon-chevron-down" ;
43+ this . sortIconStyle [ 2 ] = "glyphicon glyphicon-chevron-down" ;
44+ this . sortIconStyle [ column ] = "glyphicon glyphicon-chevron-up " ;
45+ this . rowsData = this . gridtableService . getTablesOrderBy ( 1 , name , this . rowsData ) ;
46+ }
4747 }
48- }
4948
50- clickedRow ( valor ) {
51- if ( this . selection === valor ) {
52- this . selection = undefined ;
53- } else {
54- this . selection = valor ;
49+ clickedRow ( valor ) {
50+ if ( this . selection === valor ) {
51+ this . selection = undefined ;
52+ } else {
53+ this . selection = valor ;
54+ }
55+ this . objSelected . emit ( this . selection ) ;
5556 }
56- this . objSelected . emit ( this . selection ) ;
57- }
5857}
0 commit comments