Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

sample code for using PrimeNg DataTable #355

Closed
nklt opened this issue Oct 3, 2016 · 1 comment
Closed

sample code for using PrimeNg DataTable #355

nklt opened this issue Oct 3, 2016 · 1 comment

Comments

@nklt
Copy link

nklt commented Oct 3, 2016

Hi

I like to find out if anyone can provide sample code to import and use DataTable from PrimeNg,

Based on Example code from https://github.com/aspnet/JavaScriptServices/commit/cff75c68933ebf6d2737a33f84dcb4076d1fd974, I attempt to follow http://www.primefaces.org/primeng/#/datatable to create a test component for DataTable.

For some reason, the typescript runtime (during dotnet run) complains that p_DataTable cannot be found in module, when clearly the entire PrimeNg node modules have been imported into WebPack.

The error message is:

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
      An unhandled exception has occurred: Call to Node module failed with error: Error: Template parse errors:
Can't bind to 'value' since it isn't a known property of 'p-DataTable'.
1. If 'p-DataTable' is an Angular component and it has 'value' input, then verify that it is part of this module.
2. If 'p-DataTable' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to
suppress this message.
 (" load data from the server.</p>
      <p *ngIf="!cars"><em>Loading...</em>
          <p-DataTable [ERROR ->][value]="centers">
              <p-Column field="listype" header="Type"></p-Column>
              <p-Column fi"): DataTableDemo@3:17
'p-Column' is not a known element:
1. If 'p-Column' is an Angular component, then verify that it is part of this module.
2. If 'p-Column' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to sup
press this message. ("

where DataTableDemo is the export class, and cars is the public array property.

Can anyone tell me why other smaller components like button and ratings modules are loaded, but DataTable cannot?

@SteveSandersonMS
Copy link
Member

SteveSandersonMS commented Oct 4, 2016

Sorry, I'm not sure. Since this is specific to PrimeNG, I think the question would be better directed to the maintainers of that project.

Just one thought though:

the typescript runtime (during dotnet run) complains that p_DataTable cannot be found

TypeScript doesn't really have a runtime. The message you're seeing comes from Angular. It implies that you haven't configured some directive that's needed for it to interpret the value attribute. It's not enough just for the PrimeNG code to be in your bundle - you also have to tell Angular about it (in your module config or similar - PrimeNG should have documented this).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants