shlomiassaf / ngrid

A angular grid for the enterprise
https://shlomiassaf.github.io/ngrid
MIT License
241 stars 41 forks source link

Getting started #286

Open Asaf-Malin opened 1 year ago

Asaf-Malin commented 1 year ago

Please describe the feature you would like to request.

It seems like you made a lot of effort making it easier to get started, especially in the dedicated website. Even though, I failed to get started. The website shows installation instruction (ng add @pebula/ngrid), but it doesn't give simple examples what to do after the installation. I eventually found the demos and the tiny buttons leading to their code, but when I copy code to my own project, I get errors like: Error: src/app/contacts/contacts-grid/contacts-grid.component.ts:33:13 - error TS2769: No overload matches this call. Overload 1 of 2, '(rowOptions: { header?: PblMetaRowDefinitions | undefined; footer?: PblMetaRowDefinitions | undefined; }, ...defs: PblColumnDefinition[]): PblColumnFactory', gave the following error.

I tried to look for a working stackblitz, they aren't mentioned in the website. -Can it be added to the website? I found link in Github page, and it runs on stackblitz, but when I download the project, I get the following errors:

./src/app/app.component.ts:109:13-35 - Error: Should not import the named export 'version' (imported as 'cdkPackageJson') from default-exporting module (only default export is available soon)

./src/app/app.component.ts:110:15-39 - Error: Should not import the named export 'version' (imported as 'ngridPackageJson') from default-exporting module (only default export is available soon)

./src/app/app.component.ts:111:23-55 - Error: Should not import the named export 'version' (imported as 'ngridMaterialPackageJson') from default-exporting module (only default export is available soon)

Error: src/app/datasource/index.ts:16:12 - error TS2339: Property 'default' does not exist on type '{ id: number; name: string; company: string; department: string; country: string; email: string; sales: number; rating: number; feedback: number; address: string; }[]'.

16 return x.default ?? x;

What is the use-case or motivation for this proposal?

Is there anything else we should know?

Asaf-Malin commented 1 year ago

I removed x.default ?? and changed to

import cdkPackageJson from '@angular/cdk/package.json'; import ngridPackageJson from '@pebula/ngrid/package.json'; import ngridMaterialPackageJson from '@pebula/ngrid-material/package.json';

and added "allowSyntheticDefaultImports": true,

to make it work. I can open PR if someone here to merge it