Skip to content

Commit 3250bde

Browse files
authored
feat(treeData): add new Tree Data View feature, closes #178 (#455)
* feat(treeData): add new Tree Data View feature
1 parent c23370e commit 3250bde

35 files changed

+2684
-201
lines changed

README.md

+9-12
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@
1212
### Brief introduction
1313
One of the best javascript datagrid [SlickGrid](https://github.com/mleibman/SlickGrid) which was originally developed by @mleibman is now available to Angular. I have used a few datagrids and SlickGrid beats most of them in terms of functionalities and performance (it can easily deal with even a million row). We will be using the [6pac/SlickGrid](https://github.com/6pac/SlickGrid/) fork, this is the most active fork since the original @mleibman fork was closed some time ago by his author for personal reasons. Also worth to know, I also contributed a lot to the 6pac/SlickGrid fork for the benefit of Angular-Slickgrid... also a reminder, this is a wrapper of a jQuery lib (SlickGrid), a big portion of the lib (like Editors, Filters and others) are written in jQuery/JavaScript, so just keep that in mind and it also means that jQuery is a dependecy.
1414

15-
## PLEASE HELP with Tree Data (new feature)
16-
I'm currently working on Tree Data structure, if anyone knows how to Filter/Sort a Tree Data structure (possibly by recursion), please HELP!
17-
See more info in this [open issue](https://github.com/ghiscoding/Angular-Slickgrid/issues/178#issuecomment-609922579) and this Stack Overflow [question](https://stackoverflow.com/questions/61034229/how-to-filter-multiple-properties-of-a-parent-child-array-which-could-be-several)
18-
1915
### NPM Package
2016
[Angular-Slickgrid on NPM](https://www.npmjs.com/package/angular-slickgrid)
2117

2218
### License
2319
[MIT License](LICENSE)
2420

2521
### Like it? :star: it
26-
You like and use this great library `Angular-Slickgrid`? Please upvote :star: and if you want to contribute then please feel free to do so. :smile:
22+
You like and use this great library `Angular-Slickgrid`? Be sure to upvote :star: and feel free to contribute. :smile:
23+
24+
### Like my work?
25+
If you like my work, you can also support me with caffeine :coffee:
26+
[Buy Me a Coffee](https://ko-fi.com/N4N679OT)
27+
I certainly spent a lot of time drinking coffee to build and keep adding features for this great library.
28+
29+
### It's Fully Tested with [Jest](https://jestjs.io/)
30+
Angular-Slickgrid recently reached **100%** Test Coverage, we are talking about ~8200 lines of code (~2400 unit tests) that are now fully tested with [Jest](https://jestjs.io/).
2731

2832
## Installation
2933
Refer to the **[Wiki - HOWTO Step by Step](https://github.com/ghiscoding/angular-slickgrid/wiki/HOWTO---Step-by-Step)** and/or clone the [Angular-Slickgrid Demos](https://github.com/ghiscoding/angular-slickgrid-demos) repository. Please don't open any issue unless you have followed these steps (from the Wiki), and if any of the steps are incorrect or confusing, then please let me know.
@@ -48,9 +52,6 @@ npm start
4852
- version `2.x.x` for Angular 7+
4953
- since version `2.11.0`, you can also change your build `target` to `ES2015` for modern browser.
5054

51-
### It's Fully Tested
52-
Angular-Slickgrid recently reached **100%** Test Coverage, we are talking about ~8200 lines of code (~2400 unit tests) that are now fully tested with [Jest](https://jestjs.io/).
53-
5455
#### How to load data with `HttpClient`?
5556
You might notice that all demos are coded with mocked dataset in each examples, that is mainly for demo purposes, but you might be wondering how to connect this with an `HttpClient`? Easy... just replace the mocked data, assigned to the `dataset` property, by your `HttpClient` call and that's it. The `dataset` property can be changed or refreshed at any time, which is why you can use local data and/or connect it to a `Promise` or an `Observable` with `HttpClient` (internally it's just a SETTER that refreshes the grid). See [Example 24](https://ghiscoding.github.io/Angular-Slickgrid/#/gridtabs) for a demo showing how to load a JSON file with `HttpClient`.
5657

@@ -65,10 +66,6 @@ You like the library and would like contribute? That would be awesome, the first
6566
## Wiki / Documentation
6667
The Wiki is where all the documentation and instructions will go, so please consult the [Angular-Slickgrid - Wiki](https://github.com/ghiscoding/Angular-Slickgrid/wiki) before opening any issues. The [Wiki - HOWTO](https://github.com/ghiscoding/Angular-Slickgrid/wiki/HOWTO---Step-by-Step) is a great place to start with. You can also take a look at the [Demo page](https://ghiscoding.github.io/Angular-Slickgrid), it includes sample for most of the features and it keeps growing (so you might want to consult it whenever a new version comes out).
6768

68-
## Like my work?
69-
If you like my work, you can also support me with caffeine :coffee:
70-
[Buy Me a Coffee](https://ko-fi.com/N4N679OT)
71-
7269
## Main features
7370
You can see some screenshots below and the instructions down below and if that is not enough for you to decide, head over to the [Wiki - Main Features](https://github.com/ghiscoding/Angular-Slickgrid/wiki).
7471

src/app/app-routing.module.ts

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import { GridRowMoveComponent } from './examples/grid-rowmove.component';
2525
import { GridRowSelectionComponent } from './examples/grid-rowselection.component';
2626
import { GridStateComponent } from './examples/grid-state.component';
2727
import { GridTabsComponent } from './examples/grid-tabs.component';
28+
import { GridTreeDataHierarchicalComponent } from './examples/grid-tree-data-hierarchical.component';
29+
import { GridTreeDataParentChildComponent } from './examples/grid-tree-data-parent-child.component';
2830
import { SwtCommonGridTestComponent } from './examples/swt-common-grid-test.component';
2931

3032
import { NgModule } from '@angular/core';
@@ -59,6 +61,8 @@ const routes: Routes = [
5961
{ path: 'rowdetail', component: GridRowDetailComponent },
6062
{ path: 'rowmove', component: GridRowMoveComponent },
6163
{ path: 'selection', component: GridRowSelectionComponent },
64+
{ path: 'tree-data-parent-child', component: GridTreeDataParentChildComponent },
65+
{ path: 'tree-data-hierarchical', component: GridTreeDataHierarchicalComponent },
6266
{ path: 'swt', component: SwtCommonGridTestComponent },
6367
{ path: '', redirectTo: '/basic', pathMatch: 'full' },
6468
{ path: '**', redirectTo: '/basic', pathMatch: 'full' }

src/app/app.component.html

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</a>
1212
<span style="position: relative; top: 15px">
1313
<iframe src="https://ghbtns.com/github-btn.html?user=ghiscoding&repo=angular-slickgrid&type=star&count=true"
14-
allowtransparency="true" scrolling="no" frameborder="0" width="170px" height="20px"></iframe>
14+
allowtransparency="true" scrolling="no" frameborder="0" width="170px" height="20px"></iframe>
1515
</span>
1616
</div>
1717
<div class="navbar-collapse collapse">
@@ -110,6 +110,12 @@
110110
<li routerLinkActive="active">
111111
<a [routerLink]="['/graphql-nopage']">27- GraphQL without Pagination</a>
112112
</li>
113+
<li routerLinkActive="active">
114+
<a [routerLink]="['/tree-data-parent-child']">28- Tree Data (Parent/Child)</a>
115+
</li>
116+
<li routerLinkActive="active">
117+
<a [routerLink]="['/tree-data-hierarchical']">28- Tree Data (Hierarchical)</a>
118+
</li>
113119
</ul>
114120
</section>
115121

src/app/app.module.ts

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import { GridRowMoveComponent } from './examples/grid-rowmove.component';
4040
import { GridRowSelectionComponent } from './examples/grid-rowselection.component';
4141
import { GridStateComponent } from './examples/grid-state.component';
4242
import { GridTabsComponent } from './examples/grid-tabs.component';
43+
import { GridTreeDataHierarchicalComponent } from './examples/grid-tree-data-hierarchical.component';
44+
import { GridTreeDataParentChildComponent } from './examples/grid-tree-data-parent-child.component';
4345
import { HomeComponent } from './examples/home.component';
4446
import { RowDetailPreloadComponent } from './examples/rowdetail-preload.component';
4547
import { RowDetailViewComponent } from './examples/rowdetail-view.component';
@@ -110,6 +112,8 @@ export function appInitializerFactory(translate: TranslateService, injector: Inj
110112
GridRowSelectionComponent,
111113
GridStateComponent,
112114
GridTabsComponent,
115+
GridTreeDataParentChildComponent,
116+
GridTreeDataHierarchicalComponent,
113117
RowDetailPreloadComponent,
114118
RowDetailViewComponent,
115119
SwtCommonGridTestComponent,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<div class="container-fluid">
2+
<h2 [innerHTML]="title"></h2>
3+
<div class="subtitle" [innerHTML]="subTitle"></div>
4+
5+
<div class="row">
6+
<div class="col-md-7">
7+
<button (click)="addNewFile()" class="btn btn-info btn-sm">
8+
<span class="icon mdi mdi-plus"></span>
9+
<span>Add New Pop Song</span>
10+
</button>
11+
<button (click)="collapseAll()" class="btn btn-default btn-sm">
12+
<span class="icon mdi mdi-arrow-collapse"></span>
13+
<span>Collapse All</span>
14+
</button>
15+
<button (click)="expandAll()" class="btn btn-default btn-sm">
16+
<span class="icon mdi mdi-arrow-expand"></span>
17+
<span>Expand All</span>
18+
</button>
19+
<button (click)="logFlatStructure()" class="btn btn-default btn-sm">
20+
<span>Log Flag Structure</span>
21+
</button>
22+
<button (click)="logExpandedStructure()" class="btn btn-default btn-sm">
23+
<span>Log Expanded Structure</span>
24+
</button>
25+
</div>
26+
27+
<div class="col-md-5">
28+
<div class="input-group">
29+
<input type="text" class="form-control search-string" data-test="search-string"
30+
[(ngModel)]="searchString" (ngModelChange)="searchStringChanged()">
31+
<div class="input-group-btn">
32+
<button class="btn btn-default" data-test="clear-search-string" (click)="clearSearch()">
33+
<span class="icon mdi mdi-close-thick"></span>
34+
</button>
35+
</div>
36+
</div>
37+
</div>
38+
</div>
39+
40+
<br />
41+
42+
<angular-slickgrid gridId="grid29" [columnDefinitions]="columnDefinitions" [gridOptions]="gridOptions"
43+
[datasetHierarchical]="datasetHierarchical" (onAngularGridCreated)="angularGridReady($event)">
44+
</angular-slickgrid>
45+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// You can change the SVG color using their associated SASS $icon-color-mdi-XYZ
2+
$icon-width-mdi-plus: 14px;
3+
$icon-width-mdi-arrow-collapse: 14px;
4+
$icon-width-mdi-arrow-expand: 14px;
5+
$icon-width-mdi-close-thick: 12px;
6+
$icon-color-mdi-file-pdf-outline: #f14668;
7+
$icon-color-mdi-file-music-outline: #3298dc;
8+
$icon-color-mdi-file-excel-outline: #1E9F75;
9+
$icon-color-mdi-folder: orange;
10+
$icon-color-mdi-folder-open: orange;
11+
12+
/* make sure to add the @import the SlickGrid Theme AFTER the variables changes */
13+
@import '../modules/angular-slickgrid/styles/slickgrid-theme-salesforce.scss';
14+
@import url(//db.onlinewebfonts.com/c/0fadaa21fcac88ceee0bb8da992c221b?family=SalesforceSans-Regular);
15+
16+
.icon {
17+
align-items: center;
18+
display: inline-flex;
19+
justify-content: center;
20+
height: 1.5rem;
21+
width: 1.5rem;
22+
}

0 commit comments

Comments
 (0)