Is it possible to pass parameters to js controller in lwc2019 Community Moderator ElectionLWC-Jest installation failsIs it possible to pass parameter to javascript method from template in LWC?LWC: Text Area Property ConfigurationAjax request in LWCForce refresh view in LWCJquery UI draggableImport ES modules in LWCLWC: Picklist without knowing recordTypeIdLWC: Attaching event Listener Programmatically not workingUsing Wired Property in LWC

Diode in opposite direction?

How much character growth crosses the line into breaking the character

What linear sensor for a keyboard?

Can I use my Chinese passport to enter China after I acquired another citizenship?

Divine apple island

My friend sent me a screenshot of a transaction hash, but when I search for it I find divergent data. What happened?

What is this type of notehead called?

Did arcade monitors have same pixel aspect ratio as TV sets?

Is XSS in canonical link possible?

Do Legal Documents Require Signing In Standard Pen Colors?

How do you respond to a colleague from another team when they're wrongly expecting that you'll help them?

Is a model fitted to data or is data fitted to a model?

A social experiment. What is the worst that can happen?

Translation of Scottish 16th century church stained glass

How do I implement a file system driver driver in Linux?

Why has "pence" been used in this sentence, not "pences"?

Could solar power be utilized and substitute coal in the 19th Century

What does this horizontal bar at the first measure mean?

When quoting, must I also copy hyphens used to divide words that continue on the next line?

Should I stop contributing to retirement accounts?

Is it improper etiquette to ask your opponent what his/her rating is before the game?

Did US corporations pay demonstrators in the German demonstrations against article 13?

If a character with the Alert feat rolls a crit fail on their Perception check, are they surprised?

Will adding a BY-SA image to a blog post make the entire post BY-SA?



Is it possible to pass parameters to js controller in lwc



2019 Community Moderator ElectionLWC-Jest installation failsIs it possible to pass parameter to javascript method from template in LWC?LWC: Text Area Property ConfigurationAjax request in LWCForce refresh view in LWCJquery UI draggableImport ES modules in LWCLWC: Picklist without knowing recordTypeIdLWC: Attaching event Listener Programmatically not workingUsing Wired Property in LWC










3















I am trying to implement a drag and drop functionality in lwc and I am getting the below code:



<template for:each=leftTask for:item="task">
<div class="draggable" draggable="true" key=task.taskId ondragstart=handleDragStart(task.taskId)>task.name</div>
</template>


However, it seems that lwc doesn't allow passing parameters directly into handle functions. So the above code won't work. I am wondering is it possible to pass any parameter into js handler at all? Or do I have to make a separate child component in order to handle this?










share|improve this question


























    3















    I am trying to implement a drag and drop functionality in lwc and I am getting the below code:



    <template for:each=leftTask for:item="task">
    <div class="draggable" draggable="true" key=task.taskId ondragstart=handleDragStart(task.taskId)>task.name</div>
    </template>


    However, it seems that lwc doesn't allow passing parameters directly into handle functions. So the above code won't work. I am wondering is it possible to pass any parameter into js handler at all? Or do I have to make a separate child component in order to handle this?










    share|improve this question
























      3












      3








      3


      1






      I am trying to implement a drag and drop functionality in lwc and I am getting the below code:



      <template for:each=leftTask for:item="task">
      <div class="draggable" draggable="true" key=task.taskId ondragstart=handleDragStart(task.taskId)>task.name</div>
      </template>


      However, it seems that lwc doesn't allow passing parameters directly into handle functions. So the above code won't work. I am wondering is it possible to pass any parameter into js handler at all? Or do I have to make a separate child component in order to handle this?










      share|improve this question














      I am trying to implement a drag and drop functionality in lwc and I am getting the below code:



      <template for:each=leftTask for:item="task">
      <div class="draggable" draggable="true" key=task.taskId ondragstart=handleDragStart(task.taskId)>task.name</div>
      </template>


      However, it seems that lwc doesn't allow passing parameters directly into handle functions. So the above code won't work. I am wondering is it possible to pass any parameter into js handler at all? Or do I have to make a separate child component in order to handle this?







      lightning-web-components






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      Lance ShiLance Shi

      7,51133076




      7,51133076




















          1 Answer
          1






          active

          oldest

          votes


















          4














          You can read data directly from the target:



          <div data-id=task.taskId class="draggable" draggable="true" key=task.taskId 
          ondragstart=handleDragStart>task.name</div>



          function handleDragStart(event) 
          var taskId = event.target.dataset.id;
          // ...






          share|improve this answer






















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "459"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f255011%2fis-it-possible-to-pass-parameters-to-js-controller-in-lwc%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4














            You can read data directly from the target:



            <div data-id=task.taskId class="draggable" draggable="true" key=task.taskId 
            ondragstart=handleDragStart>task.name</div>



            function handleDragStart(event) 
            var taskId = event.target.dataset.id;
            // ...






            share|improve this answer



























              4














              You can read data directly from the target:



              <div data-id=task.taskId class="draggable" draggable="true" key=task.taskId 
              ondragstart=handleDragStart>task.name</div>



              function handleDragStart(event) 
              var taskId = event.target.dataset.id;
              // ...






              share|improve this answer

























                4












                4








                4







                You can read data directly from the target:



                <div data-id=task.taskId class="draggable" draggable="true" key=task.taskId 
                ondragstart=handleDragStart>task.name</div>



                function handleDragStart(event) 
                var taskId = event.target.dataset.id;
                // ...






                share|improve this answer













                You can read data directly from the target:



                <div data-id=task.taskId class="draggable" draggable="true" key=task.taskId 
                ondragstart=handleDragStart>task.name</div>



                function handleDragStart(event) 
                var taskId = event.target.dataset.id;
                // ...







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered yesterday









                sfdcfoxsfdcfox

                261k12207452




                261k12207452



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Salesforce Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f255011%2fis-it-possible-to-pass-parameters-to-js-controller-in-lwc%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

                    Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

                    Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.