I have encountered an issue with a basic component responsible for managing display classes on my data tables. It seems that the only way I can make it function properly is by having the data table load within the actual component itself. Strangely, when I attempt to use the buttons on data tables in other components, they do not respond. Despite importing the necessary class and including the directive, it appears that the functionality does not extend beyond its own nested scope.
import {Component} from 'angular2/core';
import {NgClass} from 'angular2/common';
import {DataTable} from '../../components/datatable/datatable';
import {TestDatatable} from "../../views/grids/testDatatable";
@Component({
selector: 'show-parent',
inputs: ['isDisabled'],
directives: [NgClass, TestDatatable],
template: `
<i class="fa fa-sitemap" (click)="toggleOpen($event)"></i>
<i class="fa fa-th-large" (click)="toggleSplitScreen($event)"></i>
//The buttons work on this datatable below but if I move
// this selector somewhere else it no longer works
<myDatatable [ngClass]="{'panel-open': isOpen, 'panel-split':
isSplit}" class="parent-grid"></myDatable>
`
})
export class ShowParent {
isOpen = false;
isSplit = false;
toggleOpen(event) {
event.preventDefault();
this.isOpen = !this.isOpen;
}
toggleSplitScreen(event) {
event.preventDefault();
this.isSplit = !this.isSplit;
}
}