App.tsx
export default class App extends React.Component<{}, {}>{
public pageSettings: PageSettingsModel = { pageSize: 4 };
public editOptions: EditSettingsModel = { allowEditing: true, allowAdding: true, allowDeleting: true };
public settings: any = { persistSelection: true };
public toolbarOptions: ToolbarItems[] = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];
public numericParams: IEditCell = { params: { decimals: 2 } };
public ddParams: IEditCell = { params: { value: 'Germany' } };
public elem : HTMLElement;
public datePickerObj: DatePicker;
public datepickerTemp : IEditCell = {
create:()=>{
this.elem = document.createElement('input');
return this.elem;
},
destroy:()=>{
this.datePickerObj.destroy();
},
read:()=>{
return this.datePickerObj.value;
},
write:(args:{rowData: any, column: any})=>{
this.datePickerObj = new DatePicker({
floatLabelType: 'Never',
value: new Date(args.rowData[args.column.field])
});
this.datePickerObj.appendTo(this.elem);
}
};
constructor(props) {
super(props);
// Bind functions
// this.editTemplate = this.editTemplate.bind(this);
}
public render() {
return(<div>
<GridComponent id="Gridone" dataSource={data} allowSelection={true} allowPaging={true}
allowSorting={true} toolbar={this.toolbarOptions} allowFiltering={true} filterSettings={{ type: "Excel" }} editSettings={this.editOptions}>
<ColumnsDirective>
<ColumnDirective field='OrderID' isPrimaryKey={true} width='100'/>
<ColumnDirective field='CustomerID' width='100'/>
<ColumnDirective field='Freight' editType= 'numericedit' edit={this.numericParams} width='100'/>
<ColumnDirective field='ShipCity' width='100'/>
<ColumnDirective field='ShipCountry' editType= 'dropdownedit' edit={this.ddParams} width='100'/>
<ColumnDirective field='OrderDate' headerText='Order Date' type= 'date' format= 'yMd' edit={this.datepickerTemp} width='150'/>
<ColumnDirective field='ShipRegion' width='100'/>
</ColumnsDirective>
<Inject services={[Edit, Toolbar, Selection, Filter, Sort]} />
</GridComponent>
</div>)
}
};
|
Hi Ervin,
Greetings from syncfusion support
Query : Script error thrown in development mode.Based on your update we checked in our sample with numericedit, dropdownedit, and datetimepickeredit controls but we did not face any issue in our sample.
For your convenience we have attached the sample and please download the sample from the following link
Sample:
To find out root cause of the issue, we need the following details
1. Share the complete Grid code example.
2. Share the Angular version. (Angular 8 or Angular 9).
3. Have you used editTemplate feature in EJ2 Grid? If yes, please share the code example.
4. Have you used editParams in any of numericedit, dropdownedit, and datetimepickeredit controls?
Please get back to us with the following details it will help us to find out root cause of the issue.
RegardsMagesh
ngOnInit(): void {
this.data = data.slice(0,5);
this.toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];
this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true };
this.dpParams = { params: { query: new Query(), actionComplete: () => false,
allowFiltering: true, fields: { text: 'ShipCountry', value: 'Id' }, dataSource: this.dropdownData} };
this.initialPage = { pageSizes: true, pageCount: 4 };
}
|
I have warning as above. I am using React.
my package.json
"@syncfusion/ej2": "19.1.69",
"@syncfusion/ej2-base": "^19.1.64",
"@syncfusion/ej2-data": "19.1.63",
"@syncfusion/ej2-layouts": "19.1.63",
"@syncfusion/ej2-react-base": "19.1.69",
"@syncfusion/ej2-react-buttons": "19.1.63",
"@syncfusion/ej2-react-calendars": "19.1.66",
"@syncfusion/ej2-react-charts": "^19.1.69",
"@syncfusion/ej2-react-circulargauge": "19.1.63",
"@syncfusion/ej2-react-dropdowns": "19.1.69",
"@syncfusion/ej2-react-grids": "19.1.69",
"@syncfusion/ej2-react-inputs": "19.1.67",
"@syncfusion/ej2-react-layouts": "19.1.63",
"@syncfusion/ej2-react-lists": "19.1.65",
"@syncfusion/ej2-react-navigations": "19.1.69",
"@syncfusion/ej2-react-notifications": "19.1.63",
"@syncfusion/ej2-react-pdfviewer": "^19.1.69",
"@syncfusion/ej2-react-popups": "19.1.67",
"@syncfusion/ej2-react-querybuilder": "^19.1.63",
"@syncfusion/ej2-react-schedule": "^19.1.69",
"@syncfusion/ej2-react-splitbuttons": "19.1.63",
"@syncfusion/ej2-react-treegrid": "^19.1.67",
"react": "^16.13.1",
"react-dom": "^16.13.1",
MyComponent: