This is a migrated thread and some comments may be shown as answers.

Importing EditTemplateDirective

5 Answers 238 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mojtaba
Top achievements
Rank 1
Mojtaba asked on 20 Nov 2018, 10:01 AM

Hi,

In my .ts file I would like to use EditTemplateDirective; so, I put it there and Visual Studio imported it from "@progress/kendo-angular-grid/dist/es2015/editing/edit-template.directive". Although, Typescript compiler was happy with that, Kendo Grid was not working; it seemed Kendo Grid is using a different EditTemplateDirective. I changed the path for import to "@progress/kendo-angular-grid/dist/es/editing/edit-template.directive", and my guess was correct. Kendo Grid was happy with this import. However, Typescript compiler does keeps throwing compiler error for EditTemplateDirective, seems does not recognise that.

I noticed the same story is true for CommandColumnComponent. So, what is the problem there?

Thanks,

Mojaba

5 Answers, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 22 Nov 2018, 08:01 AM
Hello Mojtaba,

Indeed not all types, needed for various Grid functionalities are exposed for importing from the main Grid package (@progress/kendo-angular-grid) directly - the recommended approach. The EditTemplateDirective is designed to be used as an attribute/directive, as opposed to being instantiated or referenced as type, e.g.:

<kendo-grid-column field="ProductName" title="Name" width="200">
              <ng-template kendoGridEditTemplate let-column="column" let-formGroup="formGroup" let-isNew="isNew">
...

... and the CommandColumnComponent - in the Grid markup via its selector, e.g.:

<kendo-grid-command-column title="command" width="220">
           <ng-template kendoGridCellTemplate let-isNew="isNew">
             <button kendoGridEditCommand [primary]="true">Edit</button>
             <button kendoGridRemoveCommand>Remove</button>
             <button kendoGridSaveCommand [disabled]="formGroup?.invalid">{{ isNew ? 'Add' : 'Update' }}</button>
             <button kendoGridCancelCommand>{{ isNew ? 'Discard changes' : 'Cancel' }}</button>
           </ng-template>
         </kendo-grid-command-column>

Can you please elaborate in a bit more details what necessitates importing these types and referencing them in code, so we can consider exposing them or trying to provide an alternative solution based on the specific use case? Thank you in advance.

Regards,
Dimiter Topalov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Mojtaba
Top achievements
Rank 1
answered on 22 Nov 2018, 10:47 AM

Hi Dimiter,

Thank you for your reply.

I have explained my use-case in a separate thread here.

Thanks,

Mojtaba

0
Mojtaba
Top achievements
Rank 1
answered on 22 Nov 2018, 10:47 AM

Hi Dimiter,

Thank you for your reply.

I have explained my use-case in a separate thread here.

Thanks,

Mojtaba

0
Mojtaba
Top achievements
Rank 1
answered on 22 Nov 2018, 10:50 AM

Hi Dimiter,

Thank you for your reply.

I have explained my use-case in a separate thread here.

Thanks,

Mojtaba

0
Dimiter Topalov
Telerik team
answered on 26 Nov 2018, 09:58 AM
Hello Mojtaba,

Thank you for providing further context. I logged an enhancement issue for making the Grid CommandColumnComponent available for import that you can track here:

https://github.com/telerik/kendo-angular/issues/1942

Meanwhile, you can use a regular Grid column with the required command buttons within the template, e.g.:

https://stackblitz.com/edit/angular-h4m7ns?file=app/app.component.ts

I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Mojtaba
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Mojtaba
Top achievements
Rank 1
Share this question
or