After looking at all the code you sent me, I am pretty sure the problem you are encountering is the same as the one reported here, which appears to be a Framework issue yet to be resolved.
That said, I have a better workaround than the one one suggested in that post. The problem seems to happen when the call returns an empty array such as what would happen for those items marked non-completed. But, it occurred to me that you might want to re-consider how you are getting the data and instead of returning all the data in each doInit and then using the aura:if to only display what you want. Instead you can resolve this (and I verified it worked by the way), by simply changing your code to pass the completed flag to the getWhiteboardItemsDB method in your Apex class and only return the data you actually want.
This would involve changing the code in your Apex Controller to look like the following:
public with sharing class ListWhiteboardItemsApexController {
@AuraEnabled
public static List<Whiteboard_Item__c> getWhiteboardItemsDB(Boolean completed) {
return [SELECT Id, OwnerId, IsDeleted, Name, CreatedDate, LastModifiedDate, CreatedById, LastModifiedById, SystemModstamp,
AssignedTo__c, Completed__c, CompletedBy__c, Completed_Date__c, High_Priority__c, Display__c, Item_Due_Date__c
FROM Whiteboard_Item__c
WHERE Completed__c =: completed];
}
}
And also change the code in the helper function that calls this method to look like the following:
getWhiteboardItems : function(component) {
var action = component.get('c.getWhiteboardItemsDB');
var completed = component.get('v.completed');
action.setParams({ "completed" : completed});
action.setCallback(this, function(response) {
var state = response.getState();
if(component.isValid() && state == "SUCCESS") {
component.set("v.whiteboardItems", response.getReturnValue());
}
});
$A.enqueueAction(action);
}
You can then leave your code in the ListItems component with the aura:if and it should work without getting the error.
Please let me know if you think this would work and if so, mark this as the answer so it can possibly help other people.
I was able to reproduce the issue with locker service enabled.Looks like a bug in LC.
As a workaround, you could create new instance of the array and set it to alltests
aura:attribute.
So replace below line in the add
method:
c.set("v.alltests", alltests);
By this line:
c.set("v.alltests", [].concat(alltests));
So your add method will look like this:
add : function(c, e, h) { // Hooked to new element button on UI
var alltests = c.get("v.alltests");
alltests.push( {'sobjectType': 'Test__c', 'Name':''} ); // Input is loaded blank and should be filled by user
c.set("v.alltests", [].concat(alltests)); // create new instance of array everytime
}
P.S : Also, I would encourage you to raise a case with sf support.So that they can fix this issue in the framework.
Best Answer
Trying it on my end... something funky definitely happening there, having to do with binding a numeric value to that text field. Here is my stupid hack of a fix:
Adding '' + the index ensures it treats it as a string and that seems to unbreak the select list.
Note also that you can bind a Map[] directly to the
items
property ofui:inputSelect
. For example: