We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Pass Tab Reference

Thread ID:

Created:

Updated:

Platform:

Replies:

131794 Jul 27,2017 10:22 AM Jul 28,2017 12:52 PM Angular 1
loading
Tags: ejTab
Sumair Ahmed
Asked On July 27, 2017 10:22 AM

Hi have a problem in that i have a tabComponent.  I pass inject a service and pass the tabs array in the service.

I load the tabControl on application startup and insert the contents of another component.  This works a charm already.  At this point the instance of the tabComponent is already created.

I then have  a ribbon Control.  I want to press a button and insert content into the already created tabComponent. But i can't work out how to do this.  I have a method called addTab in the tabComponent.

TabComponent
ngAfterViewInit() {
// this.createNewTab('dashboard', 'Dashboard' + this.tempTestCounter, {});
this.createNewTab(this._mainTabService.componentModulePath, this._mainTabService.tabName, {});
}

TabService
@Injectable()
export class MainTabService implements iMainTabService {
tabComponents = {};
usedTabs = {};
hiddenTabs: Array<number>;
currentTabId = "tabContent0";
tabName: string; // #mainTabControl
componentModulePath: string;
viewContainerRef: ViewContainerRef;

constructor() {
this.hiddenTabs = Array<number>();
this.tabName = 'Dashboard';
this.componentModulePath = 'dashboard';
}
}

handleRibbonEvent(args) {
switch(args.target.id) {

case 'Default_new_business':
let factory = this.componentFactory.resolveComponentFactory(TabComponent);
this.viewContainerRef = this.tab.createComponent(factory);
//ref.instance.createNewTab('dashboard','Dashboard', {});

default:
break;
}
}


Keerthana Rajendran [Syncfusion]
Replied On July 28, 2017 12:52 PM

Hi Sumair, 
 
Thank you for contacting Syncfusion support. 
 
We have prepared a sample based on our understanding. Please download the sample from the below link 
 
 
In the above sample we have inserted a Grid control from another component into Tab on button click. If we have misunderstood your requirement please get back to us with the following details 
 
  1. Whether you are trying to insert Ribbon control into tab
  2. Or you have to use a button in Ribbon to add tab item
  3. Whether any controls has to be inserted into tab dynamically on button click.
 
Regards, 
Keerthana. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;