I have a component listing all my users and for each user there is a edit button which will trigger an application event to set the content (as seen here) of the userItem to allow the input by the user.

As I understand it, my event is on a application level, each component handling this event will respond if the event is fired. As I want to edit a user at a time on my list, my approach isn't good.

So how do I do to fire an event for a single component which is displayed multiple times but for different instances ?

Thank you

I realize I have to use component events, as they do not interfere with others components. Can someone show me an example for my context ?

Thanks in advance.

1 Answer 1


For anyone wondering, you just have to set body of the item you want to change, see below for an example

Provided you have a button which will trigger the function navToUserEdit

navToUserEdit : function(component, event) {
    var destination = "markup://c:userEdit";
    $A.componentService.newComponentAsync(this, function(item) {
        var content = component.find("content");
        content.set("v.body", item);
    }, {
        componentDef: destination,
        attributes: {
            values: {
                userFromEvent: "{!v.user}"
    }, component);

With the newComponentAsync, I can send the attribute user to the userEdit component, and now I can manage its behaviour for editing purposes.

Note that the destination is hardcoded, it's not an event either, but it does the trick.

Also, if you're on the one/one.app, you don't have to do that, just use the navigateToComponent featured in Salesforce1, as seen here

You must log in to answer this question.

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