• jlang
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Can anyone actually get this trailhead to work?
https://developer.salesforce.com/trailhead/project/slds-lightning-components-workshop/slds-lc-4

​I've been trying to learn lightning / lds and maybe i'm missing something?

Component Code:
<aura:component >
  <aura:attribute name="class" type="String" description="CSS classname for the SVG element" />
  <aura:attribute name="xlinkHref" type="String" description="SLDS icon path. Ex: /assets/icons/utility-sprite/svg/symbols.svg#download" />
  <aura:attribute name="ariaHidden" type="String" default="true" description="aria-hidden true or false. defaults to true" />
</aura:component>
Render code:
({
	//Overwrite default render function for svg component
	render: function(component, helper){
		var classname = component.get("v.class");
		var xlinkhref = component.get("v.xlinkHref");
		var ariaHidden = component.get("v.ariaHidden");

		var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
		svg.setAttribute('class', classname);
		svg.setAttribute('aria-hidden', ariaHidden);
		svg.innerHTML = '<use xlink:href="'+ xlinkhref +'"></use>';
		return svg;
	}
})
App Code
<aura:application >
  <div class="slds">
    <ltng:require styles="/resource/SLDS0120/assets/styles/salesforce-lightning-design-system-ltng.css" />
    <span class="slds-icon__container slds-icon-standard-account">
      <c:svg class="slds-icon" xlinkHref="/resource/SLDS0120/assets/icons/standard-sprite/svg/symbols.svg#account" />
        <span class="slds-assistive-text">Account Icon</span>
    </span>
  </div>
</aura:application>
Error:
Error during init : Object doesn't support property or method 'replace'

​Also, enabling debug on lightning components doesn't seem to make a difference, no error is thrown in console so I'm not sure really how to even find my JS in the console sources.
 

Hi,

 

I am attempting to use the new $RemoteAction variable and Visualforce.remoting.Manager.invokeAction() function in the summer 12 release.

 

I have successfully used them to call a remote action function when that function takes a single argument as its input, e.g.


Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.RemoteController.test1Str}','1 argument', handleReturn,{escape: true});

 

I have methods currently working in salesforce which accept 0 and 2 or more arguments. The obvious way of calling these to me would be to simply include the arguments separated by commas as that is what is done with the current calls, e.g.

RemoteController.test0Str( handleReturn,{escape: true})

 would map to

Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.RemoteController.test0Str}', handleReturn,{escape: true});

 and likewise for 2 arguments:

RemoteController.test2Str('2','arguments',  handleReturn,{escape: true})
Visualforce.remoting.Manager.invokeAction('RemoteController.test2Str','2','arguments', handleReturn,{escape: true})

 But for these two cases I get the following logged to the JS console:

Visualforce Remoting: Parameter length does not match remote action parameters: expected 0 parameters, got
Visualforce Remoting: Parameter length does not match remote action parameters: expected 2 parameters, got  

 So it is clear that salesforce know what it is expecting, but it is not clear how I pass the arguments.

 

I have also attempted passing the arguments as an array ,e.g.

[]
['1 argument']
['2','arguments']

 and (in desparation) as a single object with the argument names as the parameter names! None of this works.

 

Has anyone had any success using remoting in this fashion? There is a gist of my code at https://gist.github.com/2713502.

 

Regards,

 

James