• Marco Schmit
  • NEWBIE
  • 2 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 5
    Questions
  • 2
    Replies
Hi guys,

I'm trying to handle the following task:

a component creates on the init-event a component dynamically
CREATOR COMPONENT

#### .cmp ####
<aura:handler name="someEvent" event="someEvent" action="{!c.someEventHandler}"/>

<aura:handler name="init" value="{!this}" action="{!c.createDetail}"/> {!v.body} </div>

### .controller ###
createComp : function(component, event, helper){
		component.set("v.body", []);

		$A.createComponent(
			"c:someComp",
			{},
			function(newComp){
				var newCompBody = component.get("v.body");
				newCompBody.push(newComp);
				component.set("v.body", newCompBody);
			}
		);
},

someEventHandler : function(component, event, helper){
console.log("event caught");
}


This works just fine. A component event is fired in the component that got created dynamically. This event should be handled by the component that created the other component but its not working ... (console.log does not show up)
 
CREATED COMPONENT

##### .cmp ####
<aura:registerEvent name="someEvent" type="c:someEvent" />

### .controller ###
// action for a button
someAction : function(component, event, helper){
		var someEvent = component.getEvent("someEvent");
		someEvent.fire();
		console.log("save event fired");
	}

Any suggestions?

Thanks!
 
Hi,

I'm trying to figure out how to share something like global settings/attributes (fetched by apex) and functions throughout all components within an lightning app.
Is there some best practice for this use case?

Thanks!
Hi,

I just ran into an issue using ui:textInput within aura:iteration
 
<aura:attribute name="test" type="String[]" default="test1, test2"></aura:attribute>

<aura:iteration items="{!v.test}" var="t">
      {!t}
      <ui:inputText value="{!t}"></ui:inputText>
</aura:iteration>

so when I type something in the input box and leave it, the output should change too, shouldnt it?
Any help?
Thanks!
 
Hi guys,

I'm currently trying to implement a floating material design button that has a fixed position.
Normally I would do it this ways:
.THIS #someBtn {
position: fixed;
bottom:10px;
right:10px;
}

This should put the button at the bottm to the right side and should stay there when I scroll but it does not really work.
Any suggestions?

Thank you!


 
Hi,

I'm currenty trying to master this use case:
Lets say we have an object and on the page we have the option to delete this object. Now the delete button gets clicked and a bootstrap modal pops up asking if this object really should be deleted. By clicking yes the object gets deleted.

My problem is to remember this clicked object so I know which one has to be deleted by clicking the modal yes button. 
So in a nutshell ... how can I pass the object id to a component parameter when the delete button gets clicked?

Thank you!
Hi,

I'm currenty trying to master this use case:
Lets say we have an object and on the page we have the option to delete this object. Now the delete button gets clicked and a bootstrap modal pops up asking if this object really should be deleted. By clicking yes the object gets deleted.

My problem is to remember this clicked object so I know which one has to be deleted by clicking the modal yes button. 
So in a nutshell ... how can I pass the object id to a component parameter when the delete button gets clicked?

Thank you!
Hi, I need help. I seem to have decently followed the steps of creating a lighting component. I have a page that has links and these links have to be shown specific to user profile.  I am trying all these through a helloWorld component... I am using Chrome.

I have created an apex class, that has just one method : Here it goes.

(1) Apex Class
------------------
public with sharing class helloWorldApex {

       @AuraEnabled
 public String getCurrentUserProfile()
    {
        System.debug('Invoking helloWorldApex class-------------------');
        System.debug('User Id is --------'+UserInfo.getUserId());
        System.debug('User Name is --------'+UserInfo.getFirstName()) ;
        User currentUser = [SELECT Profile.Name FROM User WHERE Id = :UserInfo.getUserId() ];
        String userProfile=currentUser.Profile.Name;
        
        if( currentUser.Profile.Name == 'System Administrator' ){
            System.debug('User does have the System Administrator Access----------');
            
        }
     return userProfile;   
    }
}
Executing ths class is fine in the Debug Console and the User Id and name do get printed in the logs.

Now, I am trying to access this method getCurrentUserProfile() from the component.
Here is my component code. It is named as 

(2) helloWorld.cmp
-----------------------
<aura:component implements="force:appHostable" controller="helloWorldApex">
    <h1>Quick Create Links</h1>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

     <ui:outputText value="Your Profile is: "/>
     <ui:outputText value="{!v.currentUserProfile}"/>

< !-- Further here I see if the user profile has got specific profile and should show the links accordingly--> 
</aura:component>

(3) Here is the controller - helloWorldController.js

({
  doInit : function(component, event, helper) {
        debugger; //This does NOT get fired. Not sure why
        alert('doInit function invoked');  //this is getting fired in the browser.. 
    
       var action = component.get("c.getCurrentUserProfile"); //When control comes here, it throws an error in the browser ("Something has gone wrong. Cannot read property '$getActionDef$' of undefined. Please try again")

       alert('2');//this is not getting invoked
       action.setCallback(this, function(response) {
        var state=response.getState();
      alert();
      component.set("v.currentUserProfile", a.getReturnValue());
      });
    $A.enqueueAction(action);
   },
  
})

Can anyone tell me what I am missing ?

Thanks
Sajiv
 

 
Hi,

I'm currenty trying to master this use case:
Lets say we have an object and on the page we have the option to delete this object. Now the delete button gets clicked and a bootstrap modal pops up asking if this object really should be deleted. By clicking yes the object gets deleted.

My problem is to remember this clicked object so I know which one has to be deleted by clicking the modal yes button. 
So in a nutshell ... how can I pass the object id to a component parameter when the delete button gets clicked?

Thank you!
I have a lightning component with a tall iframe inside of it.

In a normal web browser, the scrollbar appears in the browser window and I can scroll vertically as expected. However on Salesforce1 on IOS, my app does not scroll at all. Is there anything I can specify to make the component scroll in the Salesforce1 app?

Update - I'm certain this issue is being caused by the iframe itself. If I drag my finger along the margins of the component then scrolling works. 

User-added image