IgniteUI / igniteui-angular

Ignite UI for Angular is a complete library of Angular-native, Material-based Angular UI components with the fastest grids and charts, Pivot Grid, Dock Manager, Hierarchical Grid, and more.
https://www.infragistics.com/products/ignite-ui-angular
Other
571 stars 161 forks source link

IgxSimpleCombo: wrong display value when using remote binding #14044

Closed Timmeeeey closed 6 months ago

Timmeeeey commented 7 months ago

Description

When you change the model of a remote IgxSimpleCombo, then the display value doesn't change anymore.

Currently, the example for the remote simple combo doesn't work so I can't create a stackblitz. https://www.infragistics.com/products/ignite-ui-angular/angular/components/simple-combo#demo

The error could be resolved by changing the following line https://github.com/IgniteUI/igniteui-angular/blob/a75d5e3ee638cfe158bc6e9d11a5ed0399a886ab/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.ts#L526

to: this._remoteSelection = {}

Steps to reproduce

  1. Select a value
  2. Change the value programmatically
  3. Select any other value

Result

The displayed value doesn't change anymore.

Expected result

The displayed value should be the selected value.

Attachments

2024-04-02_16h25_08

IvanKitanov17 commented 6 months ago

Hi @Timmeeeey, I believe that the issue could be resolved on application level. Instead of modifying the value directly I recommend you using the select method of the combo and providing the value there, in addition to this you would have to ensure that the itemID that is used for loading the data matches the value so you would have to set it up in the click event as well. The remote data should be also loaded in the click event to ensure that the combo selects and displays the correct data, especially when the item is not in the currently loaded chunk.

I have modified the sample, which you can find here. Please test it and let me know if it resolves your issue or if I have misunderstood your scenario.

Timmeeeey commented 6 months ago

Hi @IvanKitanov17 I'm on vacation right now so I can't properly test your example. But in our application we use more than 100 of these combos and it would be much effort if we need to modify each one.

Currently I use a monkey patch with my suggested solution which seems to work. Is there anything wrong with it? It should prevent multiple entries in the _remoteSelection property.