+ Start a Discussion
Vivian Charlie 1208Vivian Charlie 1208 

ui:inputdate does not work properly inside aura:iteration

Hi,

I have a requirement to edit an objects date field from my lightning component. With the relationship between the objects I have to create a wrapper to display the records and necessary date fields.

When I use aura:iteration with the wrapper ui:inputdate does not work properly. The date the user selects from the calendar does not get updated on the UI, however the values is updated in the back end.

When I use aura:iteration with a list of any concrete object ui:inputdate works properly. The date the user selects from the calendar gets updated on the UI, and the values is also updated in the back end.

Has anyone faced a similar issue and know of any work around for the same?

Thanks
Vivian

Kalpesh.GandhiKalpesh.Gandhi

HI Vivian,

I am facing the same issue in my lightning component.Have you been able to find a solution to this problem, if yes please can you share the same with you.

https://developer.salesforce.com/forums/ForumsMain?id=906F0000000MNWSIA4

Jefferson FernandezJefferson Fernandez
There may be a bit of latency when aura uses a data wrapper. I have seen that on StackOverflow but i failed to bookmark the link. They advised to use JSON string when returning the value from apex to lightning: "return JSON.serialize(MyDataWrapper)" instead of returning the datawrapper object itself. I know this may seem a hassle but if you will really stick with the datawrapper approach on your UI, maybe put a few miliseconds of delay on JS before querying the values again during the re-rendering. At least you know that the speed is not the same between using a data wrapper and a concrete object on Aura.