3

I am using angular 5.0 in my project and tried to use I am also using bootstrap css in angular-cli but not material

<ngx-datatable
        [rows]="rows"
        [columns]="columns">
      </ngx-datatable>

but after installing and importing module I am unable to see grid rendered on my page.

export class AppComponent{

rows = [
    { name: 'Austin', gender: 'Male', company: 'Swimlane' },
    { name: 'Dany', gender: 'Male', company: 'KFC' },
    { name: 'Molly', gender: 'Female', company: 'Burger King' },
  ];
  columns = [
    { prop: 'name' },
    { name: 'Gender' },
    { name: 'Company' }
  ];
}

and module.ts

import { NgxDatatableModule } from '@swimlane/ngx-datatable';

@NgModule({
  imports: [
    BrowserModule,

    NgxDatatableModule
  ],
  declarations: [
    AppComponent
  ],
  providers: [
    {
      provide: HTTP_INTERCEPTORS,
      useClass: APIHeaderInterceptor,
      multi: true,
    },
    SlimLoadingBarService,
    ToastsManager,
    ToasterService,
    ToastOptions

  ],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  bootstrap: [AppComponent]
})

1 Answer 1

1

Your prop casing is wrong modify it as below,

columns = [
        { name: 'Name', prop: 'name' },
        { name: 'Gender', prop : 'gender' },
        { name: 'Company', prop : 'company' }
  ];
Sign up to request clarification or add additional context in comments.

4 Comments

Hi, thanks for update i copied this code from their demo website but even after making the changes which u have suggested still not getting grid rendered may be missing something
are you available in teamviewer?
i am on skype rahul.antilog or gmail [email protected]
the table is rendering once I declare in app.component.html since inside app.module.ts I have declared it but when I am trying to display table inside sub module of project it is not rendering

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.