Hi everyone,
I’m working with a ListPicker in SAP MDK and I’ve run into a strange issue with the setValue method.
In my project, I have a function that is executed in different places. In most cases, setValue works fine and the ListPicker is updated with the expected value.
The issue is that in one specific scenario, although the same code is executed (with the same calls and same values), the setValue call does not update the control on the screen. There are no errors in the console or log – the value just doesn’t change.
This is my code:
if (variedadId) {
const cuadros = await clientAPI.read(service, 'Cuadro', [], `$filter=ID_QUINTA eq ${quintaId}`);
const variedadIds = [...new Set(toArray(cuadros).map(c => c.ID_VARIEDAD))];
const variedadSpecifier = variedadPicker.getTargetSpecifier();
variedadSpecifier.setQueryOptions(`$filter=${variedadIds.map(id => `ID_VARIEDAD eq ${id}`).join(' or ')}`);
await variedadPicker.setTargetSpecifier(variedadSpecifier);
await variedadPicker.setValue(variedadId);
ShowToast(clientAPI,`Variedad seteada: VariedadID: ${variedadId}-Variedad:${record.VARIEDAD}`)
}At the end of the function, I show a toaster message with the selected ID and variety. Both values are displayed correctly, which means the data is fine. However, the ListPicker itself does not reflect the expected selection – instead, it automatically defaults to the first option.
The ID I normally work with is 19. When I try with other IDs (for example 0 or 1), it seems like the ListPicker tries to interpret it as an index instead of setting the actual value.
Request clarification before answering.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.