2

We are trying to convert an application written using Visualforce to Salesforce Lightning. We have following code in our lightning component. The component displays the values querried from the object properly. But however, when user edits the value in "inputText", the value gets automatically overwritten with the original value.

Need suggestion in resolving this issue. Notice that we are iterating through Wrapper.

<tbody>
    <aura:iteration var="objLIW" items="{!v.lstLIWrapper}" indexVar="productId">
        <tr>
                <td><ui:inputText class="slds-input" value="{!objLIW.lineItem.Quantity__c}" maxlength="3" /></td>
                    <td><ui:outputCurrency value="{!objLIW.lineItem.Price_Each__c}"/></td>
                    <td><ui:outputText value="{!objLIW.product.Name}"/></td>
            </tr>
    </aura:iteration>
</tbody>
  • Please post code to make it easy – Anurag A Apr 7 '17 at 19:28
2

I want you to re-look at your approach of using wrapper object, if it is absolutely necessary go for it, else avoid it if possible. Read SFDCFOx answer comment in the answer section about wrapper classes and Lightning.

https://salesforce.stackexchange.com/q/166247#comment249239_166247

Having made the above comment, I have walked down the same path and figured out what was happening. You can fix this issue by simply using updateOn attribute in the ui:inputtext and on change event you can call the JS function (or) use a button to call the JS function

<td><ui:inputText class="slds-input" value="{!objLIW.lineItem.Quantity__c}" maxlength="3" updateOn="change"/></td>

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.