0

For the DataTable, there is a row click select function and in one cell, there are action buttons.

Comp 1:

<aura:component >
    ..
    <tr class="{! 'file-list-row ' + (file.checked?'slds-is-selected':'')}" onclick="{!c.toggleRowSelect}" data-file-id="{!file.id}">

         <td>
               <c:Actions file="{!file}" objectName="cg__S3Object__c" ></c:Actions>
         </td>
    </tr>
    ..
</aura:component>

I want to stop propogation for action buttons on click. And according to documantation I have tried to:

Comp 2 (Actions):

<aura:component controller="FileListController">

..
<aura:registerEvent name="sampleComponentEvent" type="COMPONENT"/>
<aura:handler name="sampleComponentEvent" event="COMPONENT" action="{!c.handleSampleEvent}"/>

    ..
</aura:component>

and the controller should be:

handleBubbling: function(component, event, helper) {
        event.stopPropagation();
    }

Documentation: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_component_bubbling.htm

However I get this error message over and over again, no matter what I try:

enter image description here

2 Answers 2

1

Aura:registeretevent name = "samplecompnent" type ="c:eventname" you have not specified type in register event

5
  • I have tried this also, type ="c:copmEvent" but error message is same...
    – efirat
    Commented Jun 21, 2017 at 11:02
  • I just want to prevent event propagation from component to container component...
    – efirat
    Commented Jun 21, 2017 at 11:02
  • 1
    Did you specified event ="c:eventname" in handler also Commented Jun 21, 2017 at 11:05
  • 1
    Can you post what is event name and event here Commented Jun 21, 2017 at 11:06
  • Yes, I have also used this eventname for handler... <aura:registerEvent name="sampleComponentEvent" type="c:compEvent"/> <aura:handler name="sampleComponentEvent" event="c:compEvent" action="{!c.handleSampleEvent}"/>
    – efirat
    Commented Jun 21, 2017 at 11:10
1

I know it is NOT regular way, but after two hour of time lose, it works...

<aura:component >
    <div onclick="{!c.mainDivClik}">

        ..

    </div>
</aura:component>

On the controller:

mainDivClik: function(component, event, helper) {
    event.stopPropagation();
}

Thats it.

1
  • We use a similar approach in Salesforce1. Would like to see a native / aura way as well Commented Jun 21, 2017 at 12:01

You must log in to answer this question.

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