Hi Milos,
Query 1: The point here is to we change the reference of the data source if we want data in drop down to be reloaded if I understand well ?
Yes, we have to reload the data in dropdownlist once the item is removed.
Query 2: Angular advice is to avoid using jquery. Is it better solution to we use Angular way to do this ?
You can either use jquery or you can set dataSource for DropDownList through ViewChild option as shown below
|
export class AppComponent implements OnInit {
@ViewChild("ddl") dropdownRef: EJComponents<ej.DropDownList,any>;
DDDS: any[] = [];
DDFields: any = { value: 'value', text: 'text' };
constructor() {
}
removeDataSourceItem() {
this.DDDS.splice(-1, 1);
this.dropdownRef.widget.setModel({ dataSource: this.DDDS });
}
|
We have modified our previous sample based on this which can be downloaded from the below link
Query 3: Is there any way doing this without changing the reference of the data source ? I have on array of data which is binded to view, some tables, drop down and so on... Syncfusion table data source works perfectly in this case, with adding and removing single item from data source it immediately reload view.I have this problem only with drop down. If I need to change drop down reference when I need to reload data, I will louse proper reference. Or I need to change reference to all other controls (in case to synchronize data) which are connected to the same array and reload many data which is not good solution.
Currently, we don’t have two-way binding support for dataSource property in DropDownList and we have to rebind the modified dataSource for DropDownList. We will consider your suggestion and include this feature in future releases.
Query 4: When I want to check data in my data source with: this.dropDownRef.model.dataSource. It is always empty ?
We were able to get the dataSource updated in model both before and after removing an item. Please refer to the below screenshot
Before Remove:
After Remove:
Please ensure whether you are testing this after data is bound to DropDownList. Kindly, ensure this scenario in the provided sample and if issue persists get back to us with issue reproducing steps so that we can proceed further.
Regards,
Keerthana.