I am developing a lightning component. In this component there is an attribute called allItems
that contains an array of objects. Currently tested holding up to 600 objects.
However when I call a component.set
with an updated array of objects, it takes a while to set/save the attribute and update the page visually.
Is there any way to improve speed/performance of component.set
?
Code:
onItemMoved: function(component, event, helper)
{
var titleid = event.getParam("titleid");
var title = event.getParam("title");
var maxSeats = event.getParam("maxSeats");
var seatsInUse = event.getParam("seatsInUse");
var item = event.getParam("item"); //This is the item that was moved.
var allGuestsList = component.get("v.allItems");
console.log(item.index);
//Searches guest list for matching guest. .
//var actualGuest = allGuestsList.find(function(moving){return moving.id == item.id;});
//Has the guest been moved to another table?
if(item.status != title)
{
//Does table have seats spare?
if(seatsInUse>=maxSeats)
{
console.log(title, 'is full!\nMaximum guests for this table:', maxSeats);
}
else
{
item.status = title;
item.statusid = titleid;
allGuestsList[item.index] = item;
component.set("v.allItems", allGuestsList);//This Line has slow performance past 200 objects being loaded.
}
}
})