• Vinay vinay
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
The controller action marks the item attribute as packed, updates the item value provider and disables the button is the task given in Trail head.

I have written the below controller to perform the action:

({
    packItem : function(component, event, helper) {
        event.getSource().set('v.disabled',true);
        component.set('v.item.Packed__c',true);
    }
})

This is setting the Packed__c to true but I am not passing the challenge.

but when I googled, below code was suggested:

({
    packItem : function(component, event, helper) {
        event.getSource().set('v.disabled',true);
        var a = component.get("v.item",true);
         a.Packed__c = true;
         component.set("v.item",a);
    }
})

But this code is not setting Packed__c to true. Please let me know the difference between two controller.

Trail head challenge:
https://trailhead.salesforce.com/lex_dev_lc_basics/lex_dev_lc_basics_controllers
The controller action marks the item attribute as packed, updates the item value provider and disables the button is the task given in Trail head.

I have written the below controller to perform the action:

({
    packItem : function(component, event, helper) {
        event.getSource().set('v.disabled',true);
        component.set('v.item.Packed__c',true);
    }
})

This is setting the Packed__c to true but I am not passing the challenge.

but when I googled, below code was suggested:

({
    packItem : function(component, event, helper) {
        event.getSource().set('v.disabled',true);
        var a = component.get("v.item",true);
         a.Packed__c = true;
         component.set("v.item",a);
    }
})

But this code is not setting Packed__c to true. Please let me know the difference between two controller.

Trail head challenge:
https://trailhead.salesforce.com/lex_dev_lc_basics/lex_dev_lc_basics_controllers