2

I have a weird problem as this never happened to me: I have a custom wrapper class to contain 2 values, integer and single custom object. I'm creating List of this class type and then passing it to child component.

Then i display all data using aura:iteration and ui:inputText.

Problem starts when i try to change the value of field that already has some value loaded (there are empty fields, but i can edit these). If i try to change them the value is overwritten by old one.

There are no onChange attributes or change handlers, that would reload this list on change.

Any ideas what would cause this? (sorry for weird enters in code i still cant format code here properly :))

My final goal is to upsert this list when i click "Update" or create new List of objects that need upsert(ones that were changed)

<aura:iteration items="{!v.flockStatsList}" var="fs">
    <tr>
        <td>
        {!fs.Day}
        </td>
         <td>
<ui:inputNumber value="{!fs.fls.Daily_dead__c}" 
updateOn="keyup"/>
        </td>
        <td>
            <ui:inputText value="{!fs.fls.Daily_selection__c}" />
        </td>
        <td>
            <ui:inputText value="{!fs.fls.Daily_feed_consumed__c}" />
        </td>
        <td>
            <ui:inputText value="
{!fs.fls.Daily_water_consumption__c}" />
        </td>
        <td>
            <ui:inputText value="{!fs.fls.Avg_body_weight__c}" />
        </td>
        <td>
            <ui:inputText value="{!fs.fls.Number_of_weighings__c}" />
        </td>
        <td>
            <ui:inputText value="
{!fs.fls.Feed_delivery_from_farm_to_house__c}" />
        </td>
        <td>
            <ui:inputText value="{!fs.fls.Feed_code__c}" />
        </td>
        <td>
            <ui:inputText value="{!fs.fls.Note__c}" />
        </td>
 </tr>
    </aura:iteration>

1 Answer 1

1

I'm pretty sure you just need to change your ui:inputText component attributes to:

<ui:inputText value="{!fs.fls.Daily_selection__c}" updateOn="change" />

This will save the changed value back to your valueprovider when you modify the field's contents.

If this doesn't work, try removing your objects from the wrapper so that you are just referencing fs.Feed_Code__c for example

2
  • I've already tries using updateOn="change" and "keyup". That just makes it refresh faster. Thing is i need to use this wrapper as i need that data to be connected through it.
    – LinQ
    Commented Apr 12, 2017 at 8:08
  • I have found a workaround to this, problem was not iterating over list of type class, but over class that had 1 integer and 1 object per instance. When i created list of objects it started working. But then i had to do some fiddling with the rest of the code to be able to send data to aura:iteration without inserting new records. All in all everything worked out fine :) Thanks for help.
    – LinQ
    Commented Apr 12, 2017 at 9:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .