Comments (6)
There are two answers to your question depending on whether you are using a static or dynamic modal.
Static modal
For a static modal, I only use CSS to show/hide the modal so if you leave some data in your form it will still be the same when you re-open the modal.
You need to ensure that the form values are initialized/reset before calling:
component.find("theStaticModal").openModal();
.
Dynamic modal
You can create the modal and it's child components (the form) from scratch each time before you open them with $A.createComponent(...)
.
If you do that you will also need to destroy the component afterwards with component.destroy()
.
from sfdc-ui-modal.
Thanks for your help. Your modal lighting component works great! Thanks so much for sharing it.
I am using static modal. I tried to reset before calling component.find("theStaticModal").openModal();
but it did not work for "number" type of lightning:input.
Here is my lightning:input component
<lightning:input class="slds-form-element slds-size_1-of-3" type="number" label="Current value" name="Model" formatter="currency" value="{!v.newInvestmentProperty.CurrentValue__c}" />
I can reset it to "0", but I can't reset it to a blank field. I know this is got nothing to do with your modal component. I am justing wondering if you know a way to reset lightning:input (number type) to blank?
Thanks
from sfdc-ui-modal.
Hi Ming,
To reset it, I would assign null
to its value since the Number
type supports it.
However, I just tried that but the widget is not updated in that case.
This could be a bug on the lightning:input
component.
I am sorry but I don't have any alternative to propose.
Cheers,
from sfdc-ui-modal.
Thanks for your help!
I tried to set its value to 'null' and '' and none of them worked. I had to set to 0. It is not nice but it is an okay walkaround.
from sfdc-ui-modal.
@mingworld I can confirm that this is a bug.
I reported it to the lightning team.
from sfdc-ui-modal.
@pozil Thank you!
from sfdc-ui-modal.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sfdc-ui-modal.