<!DOCTYPE html>
<html>
<head>
<title>Angular2 - IgniteUI Hierarchical Grid Test</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Ignite UI Required Combined CSS Files -->
<script data-require="jquery@*" data-semver="1.9.1" src="https://code.jquery.com/jquery-1.9.1.js"></script>
<script data-require="jquery-ui@1.10.4" data-semver="1.10.4" src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link href="http://cdn-na.infragistics.com/igniteui/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
<link href="http://cdn-na.infragistics.com/igniteui/latest/css/structure/infragistics.css" rel="stylesheet" />
<!-- Ignite UI Required Combined JavaScript Files -->
<script src="http://cdn-na.infragistics.com/igniteui/2016.1/latest/js/infragistics.core.js" type="text/javascript"></script>
<script src="http://cdn-na.infragistics.com/igniteui/2016.1/latest/js/infragistics.lob.js" type="text/javascript"></script>
<!-- Polyfill(s) for older browsers -->
<script src="https://npmcdn.com/core-js/client/shim.min.js"></script>
<script src="https://npmcdn.com/zone.js@0.6.12?main=browser"></script>
<script src="https://npmcdn.com/reflect-metadata@0.1.3"></script>
<script src="https://npmcdn.com/systemjs@0.19.27/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<body>
<my-app>Loading...</my-app>
<!--
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
-->
</body>
</html>
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}
/**
* PLUNKER VERSION (based on systemjs.config.js in angular.io)
* System configuration for Angular 2 samples
* Adjust as necessary for your application needs.
*/
(function(global) {
var ngVer = '@2.0.0-rc.4'; // lock in the angular package version; do not let it float to current!
var routerVer = '@3.0.0-beta.1'; // lock router version
var formsVer = '@0.2.0'; // lock forms version
var routerDeprecatedVer = '@2.0.0-rc.2'; // temporarily until we update all the guides
//map tells the System loader where to look for things
var map = {
'app': 'app',
'@angular': 'https://npmcdn.com/@angular', // sufficient if we didn't pin the version
'@angular/router': 'https://npmcdn.com/@angular/router' + routerVer,
'@angular/forms': 'https://npmcdn.com/@angular/forms' + formsVer,
'@angular/router-deprecated': 'https://npmcdn.com/@angular/router-deprecated' + routerDeprecatedVer,
'angular2-in-memory-web-api': 'https://npmcdn.com/angular2-in-memory-web-api', // get latest
'rxjs': 'https://npmcdn.com/rxjs@5.0.0-beta.6',
'ts': 'https://npmcdn.com/plugin-typescript@4.0.10/lib/plugin.js',
'typescript': 'https://npmcdn.com/typescript@1.9.0-dev.20160409/lib/typescript.js',
'igniteui-angular2': 'https://npmcdn.com/igniteui-angular2@1.0.5/igniteui.angular2.js'
};
//packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.ts', defaultExtension: 'ts' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
'igniteui-angular2': { defaultExtension: 'js' }
};
var ngPackageNames = [
'common',
'compiler',
'core',
'http',
'platform-browser',
'platform-browser-dynamic',
'upgrade',
];
// Add map entries for each angular package
// only because we're pinning the version with `ngVer`.
ngPackageNames.forEach(function(pkgName) {
map['@angular/'+pkgName] = 'https://npmcdn.com/@angular/' + pkgName + ngVer;
});
// Add package entries for angular packages
ngPackageNames.forEach(function(pkgName) {
// Bundled (~40 requests):
packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
// Individual files (~300 requests):
//packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
});
// No umd for router yet
packages['@angular/router'] = { main: 'index.js', defaultExtension: 'js' };
// Forms not on rc yet
packages['@angular/forms'] = { main: 'index.js', defaultExtension: 'js' };
// Temporarily until we update the guides
packages['@angular/router-deprecated'] = { main: '/bundles/router-deprecated' + '.umd.js', defaultExtension: 'js' };
var config = {
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
tsconfig: true
},
meta: {
'typescript': {
"exports": "ts"
}
},
map: map,
packages: packages
};
System.config(config);
})(this);
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
import { bootstrap } from '@angular/platform-browser-dynamic';
import { AppComponent } from './app.component';
bootstrap(AppComponent);
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
import { Component } from '@angular/core';
import {IgHierarchicalGridComponent} from 'igniteui-angular2';
@Component({
selector: 'my-app',
template: `
IgHierarchical Grid Demo
<ig-hierarchical-grid [(widgetId)]='id'
[(options)]="hgridOptions"
(childGridCreating)="OverrideColumnGeneration($evt, $ui)">
</ig-hierarchical-grid>
`,
directives: [IgHierarchicalGridComponent]
})
export class AppComponent {
private hgridOptions: any;
private id: string;
MyGroup: Array<SomeClassForTheSecondBand> = [];
UserInformation: Array<SomeClassForTheFirstBand> = [];
ThirdBand: Array<SomeClassForTheThirdBand> = [];
constructor() {
this.ThirdBand.push({ Field1: "field 1 val", Field2: "field 2 val" });
this.ThirdBand.push({ Field1: "field 1 val1", Field2: "field 2 val1" });
this.MyGroup.push({ GroupName: this.ThirdBand, GroupDescription: "Testing of GroupDescription" });
this.MyGroup.push({ GroupName: this.ThirdBand, GroupDescription: "Testing of GroupDescriptionTwo" });
this.UserInformation.push({ Username: "Jeet", EmplID: "999999", Comment: "This is a comment for Jeet", Fullname: "sdfsdfs", Acctlocked: "sdfsdfsfs", GroupInformation: this.MyGroup });
this.UserInformation.push({ Username: "Kumar", EmplID: "888888", Comment: "This is a comment for Kumar", Fullname: "sdfsdfs", Acctlocked: "sdfsdfsfs", GroupInformation: this.MyGroup });
this.initGridData();
}
public initGridData() {
this.id = "MySample-Hirarchical-Grid";
let result = JSON.stringify(this.UserInformation);
console.log(result);
this.hgridOptions = {
dataSource: result,
dataSourceType: "json",
autoGenerateColumns: false,
columns:
[
{ key: "Username", dataType: "string", headerText: "Username", width: "15%" },
{ key: "EmplID", dataType: "string", headerText: "EmplID", width: "15%" },
{ key: "Comment", dataType: "string", headerText: "Comment", width: "15%" }
],
columnLayouts: [
{
key: "GroupInformation",
autoGenerateColumns: true,
columnLayouts:
[{
key: "GroupName",
autoGenerateColumns: true
}]
}
],
features: [
{
name: "Filtering"
}
]
};
}
public OverrideColumnGeneration(event: any, ui: any)
{
console.log(ui);
}
}
class SomeClassForTheFirstBand {
Username: string;
Fullname: string;
Comment: string;
Acctlocked: string;
EmplID: string;
GroupInformation: Array<SomeClassForTheSecondBand> = [];
}
class SomeClassForTheSecondBand {
GroupDescription: string;
GroupName: Array<SomeClassForTheThirdBand> = [];
}
class SomeClassForTheThirdBand {
Field1: string;
Field2: string;
}
Sample to understand IgniteUI IgHierarchical Grid Angular2 Component