angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.28k stars 6.71k forks source link

[Table] Missing definitions for header and row for WrapperTable example #10941

Open jianliao opened 6 years ago

jianliao commented 6 years ago

Bug, feature request, or proposal:

You got Missing definitions for header and row, cannot determine which columns should be rendered if you manually control changeDetection in WrapperTable example.

What is the expected behavior?

No error.

What is the current behavior?

It is very common that user want to control CD in his own code. this.table.addColumnDef(...) and this.table.addRowDef(...) called in ngAfterContentInit(...) are too late for this situation.

What are the steps to reproduce?

Replace the content of file https://github.com/angular/material2/blob/master/src/demo-app/table/custom-table/wrapper-table.ts with my fork version: https://github.com/jianliao/material2/blob/master/src/demo-app/table/custom-table/wrapper-table.ts

Run gulp serve:devapp and navigate to http://localhost:4200/table/custom-table You got this ERROR Error: Missing definitions for header and row, cannot determine which columns should be rendered. at Object.getTableMissingRowDefsError (table-errors.ts:47) at MatTable.CdkTable.ngAfterContentChecked (table.ts:244) at callProviderLifecycles (provider.ts:558) at callElementProvidersLifecycles (provider.ts:534) at callLifecycleHooksChildrenFirst (provider.ts:522) at checkAndUpdateView (view.ts:365) at callWithDebugContext (services.ts:639) at Object.debugCheckAndUpdateView [as checkAndUpdateView] (services.ts:345) at ViewRef_.detectChanges (refs.ts:259) at WrapperTable.set [as columns] (wrapper-table.ts:53)

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Current latest Angular and Material library.

Is there anything else we should know?

Blunderchips commented 3 years ago

Also envountering this problem with a simple material datatable, has there been any progress?

thomaspeugeot commented 3 years ago

I agree, this is a problematic behavior in a use case I deal with

MdKamranUddin commented 2 years ago

Hi, is there any resolution to this issue as in my angular application, one of the pages is using material table module and matHeader related things and the other page is just using mat-table but no features related to matHeader and due to this, the page is breaking giving the error as "Missing definitions for header, footer and row...". Could anyone please reply with any resolution.