ngx-bootstrap icon indicating copy to clipboard operation
ngx-bootstrap copied to clipboard

Tab does not display results unless I click on it

Open donaldhook opened this issue 10 years ago • 9 comments

I have 2 tabs on a page, each with a list of items. When i open the page, the first tab does not display data. I click on the 2nd tab and see the results. I then click on the first tab and the data is displayed.

The calls to the backend are working fine, as I can see the data being returned and populating the list used by the page.

donaldhook avatar Jul 08 '16 23:07 donaldhook

I have the same issue.Any help?

icaceres15 avatar Jul 12 '16 13:07 icaceres15

Same issue here!

felimartina avatar Jul 12 '16 13:07 felimartina

Are you setting [active] on a tab to true? Otherwise they'll all be false and no active.

philjones88 avatar Jul 13 '16 15:07 philjones88

I think problem did not have to do with ng2-bootstrap itself but with the svg we were rendering in angular

felimartina avatar Jul 13 '16 15:07 felimartina

I had active set to true on the first tab, which was the one that has the issue.

donaldhook avatar Jul 13 '16 15:07 donaldhook

@donaldhook please provide plunker so I can reproduce an issue, thanks in advance

valorkin avatar Jul 21 '16 09:07 valorkin

Further clarification on the issue. In the tab, the header row of the table and an add button are displayed in the tab, just no rows in the table are displayed even though there are results from the server. If I click the 2nd tab, I see a similar table with data, then click on the first tab, then see the data there ...

donaldhook avatar Jul 27 '16 12:07 donaldhook

I resolved the issue. It was related to the use of changeDetection: ChangeDetectionStrategy.OnPush, in the @Component definition. I ended up importing ChangeDetectionStrategy, then added this.cd.markForCheck(); in each of the data => methods where the http call results handled. Now upon initial entry of the page, the data is displaying as expected.

donaldhook avatar Aug 02 '16 15:08 donaldhook

Hi @donaldhook , I'm trying to achieve lazy loading of tabs functionality.

Let me explain my scenario. I have 2+ static tabs in a page. inside each , there is a child component. I want to load the data of tabs only on tab selection (expect for first tab). Parent.html: <div> <tabset> <tab heading="1"> <child [someInput]="input"></child> </tab> <tab heading="2"> <child [someInput]="input"></child> </tab> </tabset> </div>

Please suggest. Thank you in advance.

ItsAncientCoder avatar Jun 09 '19 07:06 ItsAncientCoder