- Home
- Forum
- Angular - EJ 2
- Providing edit params causes edit view load failure after page route navigation
Providing edit params causes edit view load failure after page route navigation
Hey,
Running Angular 11.
Upon attempting to navigate away from the page, dropdown controls break, presumably due to the [edit] parameters provided to the column.
this.regionParams = {
params: {
allowFiltering: true,
dataSource: new DataManager(this.regions),
fields: { text: 'name', value: 'id' },
query: new Query(),
actionComplete: () => false
}
};
<ejs-grid
[filterSettings]="filterOptions"
[allowFiltering]="true"
#grid
[searchSettings]="searchSettings"
[dataSource]="data"
[allowSorting]="true"
[sortSettings]="sortOptions"
[allowPaging]="true"
[pageSettings]="pageSettings"
[query]="query"
[editSettings]="editSettings"
[allowSelection]="true"
(actionComplete)="actionComplete($event)"
>
<e-columns>
<e-column field="Id" isPrimaryKey="true" [visible]="false"></e-column>
<e-column field="Name" [validationRules]="locationNameRules" headerText="Name"> </e-column>
<e-column
field="Active"
headedText="Active"
[edit]="activeParams"
editType="booleanedit"
displayAsCheckBox="true"
>
</e-column>
<e-column
field="Region.Name"
[visible]='false'
></e-column>
<e-column
field="RegionId"
[validationRules]="regionNameRules"
[valueAccessor]="valueAccess"
headerText="Region"
[edit]="regionParams"
editType="dropdownedit"
></e-column>
<e-column headerText="Action" width="100" [commands]="commands"></e-column>
</e-columns>
</ejs-grid>
The column in question seems to fail assuming that the regionParams object should be providing a fully qualified create, read, destroy, etc. functions. But in accordance with the documentation, I am providing a param.
This issue seems to be a bug as the controls work as intended initially, but upon navigating away from the page and back to the page causes the issue. (See video)
The error returned is: col.edit.create is not a function
Attachment: Bug_1b0b1e9f.zip
|
App.component.html
<span> <button (click)="showGridFirst()" >Grid1</button>
<button (click)="showGridSecond()">Grid 2</button> <span>
<div class="control-section">
<div *ngIf="view1" class="col-lg-9">
<ejs-grid #normalgrid id='Normalgrid' [dataSource]='data1' allowPaging='true' [pageSettings]='pageSettings'
[editSettings]='editSettings' [toolbar]='toolbar' (actionBegin)='actionBegin($event)'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='140' [visible]="false" textAlign='Right' isPrimaryKey='true'
[validationRules]='orderidrules'></e-column>
<e-column field='CustomerID' headerText='Customer ID' width='140' [validationRules]='customeridrules'>
</e-column>
<e-column field='Freight' headerText='Freight' width='140' format='C2' textAlign='Right' editType='numericedit'
[validationRules]='freightrules'></e-column>
<e-column field='OrderDate' headerText='Order Date' width='120' editType='datetimepickeredit'
[format]='formatoptions' textAlign='Right'></e-column>
<e-column field='Verified'[type]="checkbox" editType="booleanedit"
displayAsCheckBox="true" width='140' >
</e-column>
<e-column field='ShipCountry' headerText='Ship Country' width='150' editType='dropdownedit' [edit]='shipCountryParams'>
</e-column>
<e-column headerText='Commands' width=120 [commands]='commands'></e-column>
</e-columns>
</ejs-grid>
</div>
<div *ngIf="view2" class=" col-lg-9">
<ejs-grid grid id='grid' [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings'
[editSettings]='editSettings' [toolbar]='toolbar' (actionBegin)='actionBegin($event)'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='140' textAlign='Right' isPrimaryKey='true'
[validationRules]='orderidrules'></e-column>
<e-column field='CustomerID' headerText='Customer ID' width='140' [validationRules]='customeridrules'>
</e-column>
<e-column field='Freight' headerText='Freight' width='140' format='C2' textAlign='Right' editType='numericedit'
[validationRules]='freightrules'></e-column>
<e-column field='OrderDate' headerText='Order Date' width='120' editType='datetimepickeredit'
[format]='formatoptions' textAlign='Right'></e-column>
<e-column field='ShipCountry' headerText='Ship Country' width='150' editType='dropdownedit' [edit]='editparams'>
</e-column>
</e-columns>
</ejs-grid>
</div>
</div>
<style>
#typeddl {
min-width: 100px;
}
</style>
|
- Please try to reproduce the issue in the attached sample.
- Share the complete Grid code example.
- Have you used common grid definition for all your Grids?
- Share the Syncfusion package version.
For what it's worth -- same problem here, just through React and in a functional component. Ajith's suggestion that the dataSource was not available at initialization was exactly right, fixed that and no more error.
Hi Jim,
We are glad that your issue was resolved.
- 5 Replies
- 4 Participants
- Marked answer
-
BM Brandon M
- Jun 4, 2021 06:50 PM UTC
- Jan 22, 2024 05:58 AM UTC