We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Grid with add edit external form template

Please i wanna use grid with add/editexternal form template and it gives me error when using template for column then after comment it throws exception this errorMessage: Cannot read property '_viewRef' of null
import { Component, Input, ViewChild, ViewEncapsulation } from '@angular/core';
import { GridComponent } from 'ej-angular2/src/ej/grid.component';
//import { EJ_Grid_DetailTemplate } from '../Shared/GridDetailTemplate';
@Component({
moduleId: module.id,
selector: 'Model-Setting-Dialog',
templateUrl: '../../../../View/StructuredSketch/ModelSettingDialog.component.html',
styles: [
'.e-dialog.e-widget-content { background: none !important }'
]
})
export class ModelSettingDialog {
@Input() CurrentViews: object;
@ViewChild('grid')
public currentViewsGrid: GridComponent;
public editSettings;
public toolbarItems;
constructor() {
this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true, editMode: "externalformtemplate", externalFormTemplateID: "#template" };
this.toolbarItems = { showToolbar: true, toolbarItems: ["add", "edit", "delete", "update", "cancel"] };
}
getSelectedValue() { }
onActionComplete(e: any) {}
}
//////////////////////////////////

3 Replies

MP Manivannan Padmanaban Syncfusion Team April 5, 2019 11:22 AM UTC

Hi Amira, 

Query: errorMessage: Cannot read property '_viewRef' of null 

We are unable to reproduce the reported issue at our end. For your convenience we have created the sample based on the shared code example, refer the below link. 


After referring the sample still facing the issue, please get back to us with the following details. 

  1. Please share the Angular version.
  2. Share the Essential studio version.
  3. If possible, reproduce the reported issue in the provided sample and revert back to us.

Regards, 
Manivannan Padmanaban. 





AM Amira April 7, 2019 12:56 AM UTC

There is anyway to put <script id="template" type="text/ng-template"> in grid.html not in index.html?


VN Vignesh Natarajan Syncfusion Team April 8, 2019 04:19 PM UTC

Hi Amira,  
 
Query: “There is anyway to put <script id="template" type="text/ng-template"> in grid.html not in index.html? 
 
Sorry it is not possible to place the <script> tag in the Grid.component.html instead of index.html. Because index.html file is the first file that runs along with main.ts file. So script tag must be initialized in that file to execute properly during the run time. 
 
Please get back to us if you have any other queries.  
 
Regards, 
Vignesh Natarajan. 


Loader.
Live Chat Icon For mobile
Up arrow icon