3

I have a main component, which contains two more components. They render instead of each other dynamically, using $A.createComponent(), depending on user actions. Both of these components have <ui:inputDate> elements.

First time the component is loaded, everything is fine, but as soon as I refresh the component I have an error message with the following text:

afterRender threw an error in 'markup://ui:inputDate' : Cannot set property 'value' of null

Still, after closing the error message, component works fine, as if there is no error at all.

Did someone face such issue or have any suggestions on how to fix it?

1

I found solution to this issue, so I'll post it in case someone would face the same trouble.

The explanation lies in fact that lightning starts the unrender() method when you refresh the component, and removes all DOM from component. Right after that afterRender() method starts, which, as far as I know, should check whether all component elements are rendered. As the unrender() removed all elements, afterRender() can't find them and throws an error.

The solution was to rewrite afterRender() so it won't start if date inputs are not rendered, I used jQuery for this purpose and method looks like:

enter image description here

  • I am facing same kind of issue while putting lightning component in VF page with inputDate – Monish Oct 29 '15 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.