Commit 440e2e86b49357ab987ef99941440dc756147ba6
1 parent
6c0454b9
fixes
Showing
3 changed files
with
11 additions
and
17 deletions
Show diff stats
src/app/components/grid/rich-grid.component.html
| 1 | -<div style="width: 800px;"> | |
| 1 | +<div> | |
| 2 | 2 | <h1>Rich Grid with Pure JavaScript</h1> |
| 3 | 3 | <div style="clear: both;"></div> |
| 4 | 4 | <div *ngIf="showGrid"> |
| 5 | - <button class="btn btn-warning" (click)="addNewRow()" type="button">Добавить новое поле</button> | |
| 6 | - <button class="btn btn-danger" (click)="deleteRows()" type="button">Удалить</button> | |
| 5 | + <button md-raised-button (click)="addNewRow()" type="button">Добавить новое поле</button> | |
| 6 | + <button md-raised-button (click)="deleteRows()" type="button">Удалить</button> | |
| 7 | 7 | <div *ngIf="isLoading" class=""> |
| 8 | 8 | ...Loading |
| 9 | 9 | </div> | ... | ... |
src/app/components/grid/rich-grid.component.ts
| ... | ... | @@ -39,6 +39,7 @@ export class RichGridComponent { |
| 39 | 39 | public boolean: BooleanSelectList[]; |
| 40 | 40 | public isLoading: boolean = false; |
| 41 | 41 | public isBootstrapping: boolean = true; |
| 42 | + public isSelected: boolean = true; | |
| 42 | 43 | private columnDefs: any[]; |
| 43 | 44 | private gridOptions: GridOptions; |
| 44 | 45 | |
| ... | ... | @@ -73,7 +74,6 @@ export class RichGridComponent { |
| 73 | 74 | this.gridOptions.api.refreshVirtualPageCache(); |
| 74 | 75 | }); |
| 75 | 76 | } |
| 76 | - | |
| 77 | 77 | setRowData(allOfTheData) { |
| 78 | 78 | let dataSource = { |
| 79 | 79 | rowCount: null, // behave as infinite scroll |
| ... | ... | @@ -121,13 +121,11 @@ export class RichGridComponent { |
| 121 | 121 | { |
| 122 | 122 | headerName: 'ID', |
| 123 | 123 | field: 'busStopId', |
| 124 | - width: 150 | |
| 125 | 124 | }, |
| 126 | 125 | { |
| 127 | 126 | headerName: 'Назва дороги', |
| 128 | 127 | field: 'roadId', |
| 129 | 128 | editable: true, |
| 130 | - width: 150, | |
| 131 | 129 | cellEditorFramework: EditorComponent, |
| 132 | 130 | cellRendererFramework: RendererComponent, |
| 133 | 131 | cellEditorParams: { |
| ... | ... | @@ -140,7 +138,6 @@ export class RichGridComponent { |
| 140 | 138 | headerName: 'Область', |
| 141 | 139 | field: 'regionId', |
| 142 | 140 | editable: true, |
| 143 | - width: 150, | |
| 144 | 141 | cellEditorFramework: EditorComponent, |
| 145 | 142 | cellRendererFramework: RendererComponent, |
| 146 | 143 | cellEditorParams: { |
| ... | ... | @@ -153,19 +150,16 @@ export class RichGridComponent { |
| 153 | 150 | headerName: 'Місцезнаходження, км+ справа', |
| 154 | 151 | field: 'locationRight', |
| 155 | 152 | editable: true, |
| 156 | - width: 150 | |
| 157 | 153 | }, |
| 158 | 154 | { |
| 159 | 155 | headerName: 'Місцезнаходження, км+ зліва', |
| 160 | 156 | field: 'locationLeft', |
| 161 | 157 | editable: true, |
| 162 | - width: 150 | |
| 163 | 158 | }, |
| 164 | 159 | { |
| 165 | 160 | headerName: 'Технічний стан', |
| 166 | 161 | field: 'stateCommonId', |
| 167 | 162 | editable: true, |
| 168 | - width: 150, | |
| 169 | 163 | cellEditorFramework: EditorComponent, |
| 170 | 164 | cellRendererFramework: RendererComponent, |
| 171 | 165 | cellEditorParams: { |
| ... | ... | @@ -178,7 +172,6 @@ export class RichGridComponent { |
| 178 | 172 | headerName: 'Наявність туалету', |
| 179 | 173 | field: 'toiletAvailability', |
| 180 | 174 | editable: true, |
| 181 | - width: 150, | |
| 182 | 175 | cellEditorFramework: EditorComponent, |
| 183 | 176 | cellRendererFramework: RendererComponent, |
| 184 | 177 | cellEditorParams: { | ... | ... |
src/app/helpers/editor.component.ts
| ... | ... | @@ -5,16 +5,17 @@ import { AgEditorComponent } from 'ag-grid-ng2/main'; |
| 5 | 5 | @Component({ |
| 6 | 6 | selector: 'editor-cell', |
| 7 | 7 | template: ` |
| 8 | - <md-select #container> | |
| 9 | - <md-option *ngFor="let item of data" (click)="onClick(item[this.params.valueCol])" > | |
| 10 | - {{item[this.params.labelCol]}} | |
| 11 | - </md-option> | |
| 12 | - </md-select> | |
| 8 | + <div class="md-select-panel"> | |
| 9 | + <div #container class="md-select-content"> | |
| 10 | + <md-option *ngFor="let item of data" (click)="onClick(item[this.params.valueCol])" > | |
| 11 | + {{item[this.params.labelCol]}} | |
| 12 | + </md-option> | |
| 13 | + </div> | |
| 14 | + </div> | |
| 13 | 15 | ` |
| 14 | 16 | }) |
| 15 | 17 | export class EditorComponent implements AgEditorComponent, AfterViewInit { |
| 16 | 18 | @ViewChild('container', {read: ViewContainerRef}) public container; |
| 17 | - @ViewChild('container') public child; | |
| 18 | 19 | public item: Object = null; |
| 19 | 20 | public data: Object[]; |
| 20 | 21 | private params: any; | ... | ... |