- Home
- Forum
- Angular - EJ 2
- Edit Grid - how can I avoid a page reload if I add a new value for a dropdown field in edit mode?
Edit Grid - how can I avoid a page reload if I add a new value for a dropdown field in edit mode?
Good morning, I'll explain the problem if the title isn't clear.
When I enter edit mode in a grid, I would like to be able to update the datasource of a dropdown field (in this specific case, add another data, therefore a fast entry operation), without exiting edit mode and without having to refresh the grid itself. Is it possible?
I await your responses.
editTemplate. In the open event of the dropdown, you can dynamically add the item using the addItem method of the DropDown.Code Example : [app.component.html] <e-column field="CustomerID" headerText="Customer ID" width="180"> <ng-template #editTemplate let-data> <ejs-dropdownlist #dropDown [dataSource]="updatedDataSource" [(value)]="orderData.CustomerID" (open)="open($event)" ></ejs-dropdownlist> </ng-template> </e-column> [app.component.ts] open(args) { if (this.dropDown && !this.isOpen) { this.isOpen = true; const newItem = 'Added New Item'; this.dropDown.addItem(newItem); } } actionBegin(args) { if (args.requestType === 'beginEdit' || args.requestType === 'add') { this.orderData = Object.assign({}, args.rowData); this.isOpen = false; } if (args.requestType === 'save') { (args.data as any)['CustomerID'] = this.orderData['CustomerID']; } } |
DropDownList component in the edit form. This feature allows you to define a specific set of values for the DropDownList.query property allows you to define custom queries for data retrieval and filtering.
|
I think my question needs clarification.
I would like that while in edit mode of the grid, I can add a custom value to the dropdown datasource via API, without exiting edit mode and without refreshing the grid itself.
In the first example, the added value is done statically, and furthermore, the value is added while opening the dropdown. In my case, the value should be added by pressing an add button in a custom dropdown template, which provides a modal that add the value via API.
Could you please help me with this task?
I think my question needs clarification.
I would like that while in edit mode of the grid, I can add a custom value to the dropdown datasource via API, without exiting edit mode and without refreshing the grid itself.
In the first example, the added value is done statically, and furthermore, the value is added while opening the dropdown. In my case, the value should be added by pressing an add button in a custom dropdown template, which provides a modal that add the value via API.
Could you please help me with this task?
- You mentioned that the value should be added by clicking an "Add" button in a custom dropdown template. Is this button placed inside the Grid column, or are you rendering an external dropdown? Please share the relevant dropdown template & model code along with the complete Grid rendering code so we can understand how the dropdown is integrated, including the column configuration and the editing type you are using
- Could you provide a more detailed explanation of your exact requirement? Please share a video demo showing how you want the action to be performed.
- How is data bound to the Grid—locally or remotely? If using a remote data source, please share the adaptor details.
- Could you please share the version details of the Syncfusion Grid and related components you are using?
- Please share a minimal reproducible sample or try replicating the issue in the sample we provided.
- 4 Replies
- 2 Participants
-
SO soon
- Mar 21, 2025 08:39 AM UTC
- Mar 25, 2025 07:52 AM UTC