Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 6ab4d1f

Browse files
committed
chore: remove Remote Example & replace with Import from CSV
1 parent 7192e5a commit 6ab4d1f

File tree

8 files changed

+15
-238
lines changed

8 files changed

+15
-238
lines changed

src/app/app-routing.module.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { GridLocalizationComponent } from './examples/grid-localization.componen
3030
import { GridMenuComponent } from './examples/grid-menu.component';
3131
import { GridOdataComponent } from './examples/grid-odata.component';
3232
import { GridRangeComponent } from './examples/grid-range.component';
33-
import { GridRemoteComponent } from './examples/grid-remote.component';
3433
import { GridResizeByContentComponent } from './examples/grid-resize-by-content.component';
3534
import { GridRowDetailComponent } from './examples/grid-rowdetail.component';
3635
import { GridRowMoveComponent } from './examples/grid-rowmove.component';
@@ -40,7 +39,7 @@ import { GridTabsComponent } from './examples/grid-tabs.component';
4039
import { GridTradingComponent } from './examples/grid-trading.component';
4140
import { GridTreeDataHierarchicalComponent } from './examples/grid-tree-data-hierarchical.component';
4241
import { GridTreeDataParentChildComponent } from './examples/grid-tree-data-parent-child.component';
43-
import { Grid43Component } from './examples/grid43.component';
42+
import { Grid18Component } from './examples/grid18.component';
4443
import { SwtCommonGridTestComponent } from './examples/swt-common-grid-test.component';
4544

4645
import { NgModule } from '@angular/core';
@@ -59,7 +58,7 @@ const routes: Routes = [
5958
{ path: 'context', component: GridContextMenuComponent },
6059
{ path: 'custom-pagination', component: GridCustomPaginationComponent },
6160
{ path: 'custom-tooltip', component: GridCustomTooltipComponent },
62-
{ path: 'csv-grid', component: Grid43Component },
61+
{ path: 'csv-grid', component: Grid18Component },
6362
{ path: 'drag-recycle', component: GridDragRecycleComponent },
6463
{ path: 'editor', component: GridEditorComponent },
6564
{ path: 'excel-formula', component: GridExcelFormulaComponent },
@@ -83,7 +82,6 @@ const routes: Routes = [
8382
{ path: 'clientside', component: GridClientSideComponent },
8483
{ path: 'odata', component: GridOdataComponent },
8584
{ path: 'range', component: GridRangeComponent },
86-
{ path: 'remote', component: GridRemoteComponent },
8785
{ path: 'resize-by-content', component: GridResizeByContentComponent },
8886
{ path: 'rowdetail', component: GridRowDetailComponent },
8987
{ path: 'rowmove', component: GridRowMoveComponent },

src/app/app.component.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<a class="nav-link" routerLinkActive="active" [routerLink]="['/rowmove']">17- Row Move</a>
9393
</li>
9494
<li class="nav-item">
95-
<a class="nav-link" routerLinkActive="active" [routerLink]="['/remote']">18- Remote Model</a>
95+
<a class="nav-link" routerLinkActive="active" [routerLink]="['/csv-grid']">18- Create Grid from CSV </a>
9696
</li>
9797
<li class="nav-item">
9898
<a class="nav-link" routerLinkActive="active" [routerLink]="['/draggrouping']">19- Draggable Grouping</a>
@@ -174,9 +174,6 @@
174174
<li class="nav-item">
175175
<a class="nav-link" routerLinkActive="active" [routerLink]="['/custom-pagination']"> 42- Custom Pagination </a>
176176
</li>
177-
<li class="nav-item">
178-
<a class="nav-link" routerLinkActive="active" [routerLink]="['/csv-grid']"> 43- Create Grid from CSV </a>
179-
</li>
180177
</ul>
181178
</section>
182179

src/app/app.module.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import { GridLocalizationComponent } from './examples/grid-localization.componen
4646
import { GridMenuComponent } from './examples/grid-menu.component';
4747
import { GridOdataComponent } from './examples/grid-odata.component';
4848
import { GridRangeComponent } from './examples/grid-range.component';
49-
import { GridRemoteComponent } from './examples/grid-remote.component';
5049
import { GridResizeByContentComponent } from './examples/grid-resize-by-content.component';
5150
import { GridRowDetailComponent } from './examples/grid-rowdetail.component';
5251
import { GridRowMoveComponent } from './examples/grid-rowmove.component';
@@ -56,7 +55,7 @@ import { GridTabsComponent } from './examples/grid-tabs.component';
5655
import { GridTradingComponent } from './examples/grid-trading.component';
5756
import { GridTreeDataHierarchicalComponent } from './examples/grid-tree-data-hierarchical.component';
5857
import { GridTreeDataParentChildComponent } from './examples/grid-tree-data-parent-child.component';
59-
import { Grid43Component } from './examples/grid43.component';
58+
import { Grid18Component } from './examples/grid18.component';
6059
import { HomeComponent } from './examples/home.component';
6160
import { CustomPagerComponent } from './examples/grid-custom-pager.component';
6261
import { RowDetailPreloadComponent } from './examples/rowdetail-preload.component';
@@ -136,7 +135,6 @@ export function appInitializerFactory(translate: TranslateService, injector: Inj
136135
GridMenuComponent,
137136
GridOdataComponent,
138137
GridRangeComponent,
139-
GridRemoteComponent,
140138
GridResizeByContentComponent,
141139
GridRowDetailComponent,
142140
GridRowMoveComponent,
@@ -146,7 +144,7 @@ export function appInitializerFactory(translate: TranslateService, injector: Inj
146144
GridTradingComponent,
147145
GridTreeDataParentChildComponent,
148146
GridTreeDataHierarchicalComponent,
149-
Grid43Component,
147+
Grid18Component,
150148
RowDetailPreloadComponent,
151149
RowDetailViewComponent,
152150
SwtCommonGridTestComponent,

src/app/examples/grid-remote.component.html

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/app/examples/grid-remote.component.ts

Lines changed: 0 additions & 169 deletions
This file was deleted.

src/app/examples/grid43.component.html renamed to src/app/examples/grid18.component.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<div id="demo-container" class="container-fluid">
22
<h2>
3-
Example 43: Dynamically Create Grid from CSV / Excel import
3+
Example 18: Dynamically Create Grid from CSV / Excel import
44
<span class="float-end">
55
<a
66
style="font-size: 18px"
77
target="_blank"
8-
href="https://github.com/ghiscoding/Angular-Slickgrid/blob/master/src/app/examples/grid43.component.ts"
8+
href="https://github.com/ghiscoding/Angular-Slickgrid/blob/master/src/app/examples/grid18.component.ts"
99
>
1010
<span class="mdi mdi-link mdi-v-align-sub"></span> code
1111
</a>
@@ -45,16 +45,15 @@ <h2>
4545
<button id="uploadBtn" data-test="static-data-btn" class="btn btn-outline-secondary" (click)="handleDefaultCsv()">
4646
Use default CSV data
4747
</button>
48-
&nbsp;/
49-
<button class="btn btn-outline-danger btn-sm ms-2" (click)="destroyGrid()">Destroy Grid</button>
48+
<button class="btn btn-outline-secondary" (click)="destroyGrid()">Destroy Grid</button>
5049
</div>
5150
</div>
5251

5352
<hr />
5453

5554
<angular-slickgrid
5655
*ngIf="gridCreated"
57-
gridId="grid43"
56+
gridId="grid18"
5857
[columnDefinitions]="columnDefinitions"
5958
[gridOptions]="gridOptions"
6059
[dataset]="dataset"

src/app/examples/grid43.component.ts renamed to src/app/examples/grid18.component.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const sampleDataRoot = 'assets/data';
77
@Component({
88
styles: ['.file-upload { max-width: 300px; }'],
99
encapsulation: ViewEncapsulation.None,
10-
templateUrl: './grid43.component.html',
10+
templateUrl: './grid18.component.html',
1111
})
12-
export class Grid43Component {
12+
export class Grid18Component {
1313
columnDefinitions: Column[] = [];
1414
gridOptions!: GridOption;
1515
dataset: any[] = [];
@@ -21,16 +21,14 @@ export class Grid43Component {
2121
constructor(private readonly cd: ChangeDetectorRef) {}
2222

2323
handleFileImport(event: any) {
24-
const file: File = event.target.files[0];
25-
if (file.name.endsWith('.csv')) {
24+
const file = event.target.files[0];
25+
if (file) {
2626
const reader = new FileReader();
2727
reader.onload = (e: any) => {
2828
const content = e.target.result;
2929
this.dynamicallyCreateGrid(content);
3030
};
3131
reader.readAsText(file);
32-
} else {
33-
alert('File must be a CSV file');
3432
}
3533
}
3634

test/cypress/e2e/example43.cy.ts renamed to test/cypress/e2e/example18.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
describe('Example 43 - Dynamically Create Grid from CSV / Excel import', () => {
1+
describe('Example 18 - Dynamically Create Grid from CSV / Excel import', () => {
22
const defaultCsvTitles = ['First Name', 'Last Name', 'Age', 'Type'];
33
const GRID_ROW_HEIGHT = 33;
44

55
it('should display Example title', () => {
66
cy.visit(`${Cypress.config('baseUrl')}/csv-grid`);
7-
cy.get('h2').should('contain', 'Example 43: Dynamically Create Grid from CSV / Excel import');
7+
cy.get('h2').should('contain', 'Example 18: Dynamically Create Grid from CSV / Excel import');
88
});
99

1010
it('should load default CSV file and expect default column titles', () => {

0 commit comments

Comments
 (0)