You need to sign in to do that
Don't have an account?
TechEd_Programmer
Lightning Component LI rendering
I am struggling with how to get my component to render a list item that leverages a jQuery library. I have found that when I troubleshoot in the JAVA script console, I can get the function to work properly, however, other than that it will not work. I have seen several posts about render and rerender, but nothing seems to fit what I am attempting to do in this instance.
To explain: I have my main component passing a variable through an event to a component withing the application. Once the event fires, I am running a query and presenting a list of draggable items. The styling for the items render from the library, however the draggable ability is not there without the use of the troubleshooting. I have verified that the data is being passed correctly as well as the fact that all libraries are loading from static resources
Here is my component:
And here is my controller:
Any assistance is appreciated.
To explain: I have my main component passing a variable through an event to a component withing the application. Once the event fires, I am running a query and presenting a list of draggable items. The styling for the items render from the library, however the draggable ability is not there without the use of the troubleshooting. I have verified that the data is being passed correctly as well as the fact that all libraries are loading from static resources
Here is my component:
<aura:component controller="Evolve_lgt_Controller"> <aura:attribute name="userstory" type="object"/> <aura:attribute name="sprint" type="object"/> <aura:handler event="c:RefreshUserStories" action="{!c.list_Story_sprint}"/> <style type="text/css"> li.draggable-story { width: 75px; height: 75px; padding: 0.5em; float: left; margin: 5px 5px 5px 5px; border-style: solid; text-align: center; list-style: none;} #droppable { width: 200px; height: 400px; padding: 0.5em; float: left; margin: 10px; list-style: none; border-style: solid;} </style> <div class="userstory"> <ul id="draggable"> <aura:iteration items="{!v.userstory}" var="us"> <li class="draggable-story ui-state-default"> <p><ui:outputText value="{!us.Name}"/></p> </li> </aura:iteration> </ul> </div>
And here is my controller:
({ list_Story_sprint: function(component, event, helper) { var story = event.getParam("userstory"); var sprint = event.getParam("sprint"); helper.getStories(component, story); helper.getSprints(component, sprint); //$(document).ready(function() { console.log($( "li.draggable-story" ).length); $( "li.draggable-story" ).draggable(); $( "#droppable" ).droppable({ drop: function( event, ui ) { $( this ) .addClass( "ui-state-highlight" ) .find( "p" ); } }); //}); }, })
Any assistance is appreciated.
bob_buzzard
I'm using JQuery in a few lightning components without issue. How are you loading the resources?
Omar Salas 8
I'm looking for resources on how to integrate jQuery with lightning components. Any attempt I make to use jQuery's $ will throw a "$ is not defined." I used jQuery in the past (not a pro) but I'm new to Salesforce and Lightning Components. I've been able to aquire certain functionality using traditional javascript though I'd love to be able to use jQuery, it'd save a ton of time on a daily basis.